add non cash money display to account state

This commit is contained in:
Roland Schneider 2016-10-05 07:56:50 +02:00
parent 7975d6ffc9
commit 8585286150
8 changed files with 454 additions and 279 deletions

View File

@ -1,16 +1,12 @@
<?php <?php
namespace common\components\accountstate; namespace common\components\accountstate;
use yii\base\Widget; use yii\base\Widget;
use common\models\AccountState;
use yii\data\ArrayDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\DetailView; use yii\widgets\DetailView;
/** /**
* This is the model class for widget display bank notes. * This is the model class for widget display bank notes.
* *
* @property common\models\AccountState $model * @property \common\models\AccountState $model
* */ * */
class AccountStateWidget extends Widget{ class AccountStateWidget extends Widget{
@ -59,6 +55,16 @@ class AccountStateWidget extends Widget{
'attribute' =>'money', 'attribute' =>'money',
'value' => \Yii::$app->formatter->asInteger($this->model->money) ." Ft", 'value' => \Yii::$app->formatter->asInteger($this->model->money) ." Ft",
], ],
[
'attribute' => 'non_cash_money',
'label' => 'Készpénz alapú forgalom',
'value' => \Yii::$app->formatter->asInteger($this->model->collection_money) ." Ft",
],
[
'attribute' => 'non_cash_money',
'label' => 'Nem készpénz alapú forgalom',
'value' => \Yii::$app->formatter->asInteger($this->model->non_cash_money) ." Ft",
],
'user.username', 'user.username',
[ [
'attribute' => 'start_date', 'attribute' => 'start_date',

View File

@ -2,9 +2,9 @@
namespace common\models; namespace common\models;
use Yii; use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
Yii;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
/** /**
* This is the model class for table "account_state". * This is the model class for table "account_state".
@ -29,8 +29,9 @@ use yii\behaviors\TimestampBehavior;
* @property integer $collection_money * @property integer $collection_money
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property int non_cash_money
*/ */
class AccountState extends \common\models\BaseFitnessActiveRecord class AccountState extends BaseFitnessActiveRecord
{ {
const TYPE_OPEN = 10; const TYPE_OPEN = 10;
@ -38,16 +39,6 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
public $start_date; public $start_date;
/**
* @inheritdoc
*/
// public function behaviors()
// {
// return [[
// 'class' => TimestampBehavior::className(),
// 'value' => function(){ return date('Y-m-d H:i' ); }
// ] ];
// }
/** /**
* @inheritdoc * @inheritdoc
@ -138,7 +129,9 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
public function getAccountName(){ public function getAccountName(){
$result = ""; $result = "";
$account = $this->account; /** @noinspection PhpUndefinedFieldInspection */
/** @var \common\models\Account $account */
$account = $this->account;
if (isset($account)){ if (isset($account)){
$result = $account->name; $result = $account->name;
} }
@ -156,7 +149,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
public function getUserName(){ public function getUserName(){
$result = ""; $result = "";
$user = $this->user; /** @noinspection PhpUndefinedFieldInspection */
$user = $this->user;
if (isset($this->user)){ if (isset($this->user)){
$result = $user->username; $result = $user->username;
} }
@ -193,9 +187,9 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
* Read last accountstates * Read last accountstates
* @param $type int the type of accountstate to load * @param $type int the type of accountstate to load
* @param $user $id of user to load the account * @param $user $id of user to load the account
* @return common\models\AccountState * @param \common\models\Account|null $account
* * @return AccountState
* */ */
public static function readLast($type, $user = null,$account = null){ public static function readLast($type, $user = null,$account = null){
$result = null; $result = null;
$query = AccountState::find(); $query = AccountState::find();
@ -224,20 +218,23 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
$start = null; $start = null;
$end = null; $end = null;
$prev = null; $prev = null;
$this->prev_money = 0; /** @noinspection PhpUndefinedFieldInspection */
$this->prev_money = 0;
if ( $this->type == AccountState::TYPE_CLOSE){ if ( $this->type == AccountState::TYPE_CLOSE){
$lastOpen = AccountState::readLast(AccountState::TYPE_OPEN,\Yii::$app->user->id, $this->id_account); $lastOpen = AccountState::readLast(AccountState::TYPE_OPEN,\Yii::$app->user->id, $this->id_account);
if ( $lastOpen != null ){ if ( $lastOpen != null ){
$start = $lastOpen->created_at; $start = $lastOpen->created_at;
$this->prev_state = $lastOpen->id_account_state; /** @noinspection PhpUndefinedFieldInspection */
$this->prev_money = $lastOpen->money; $this->prev_state = $lastOpen->id_account_state;
/** @noinspection PhpUndefinedFieldInspection */
$this->prev_money = $lastOpen->money;
} }
$end = date('Y-m-d H:i:s' ); $end = date('Y-m-d H:i:s' );
// $end = Yii::$app->formatter->asDatetime(strtotime("now"), "php:Y-m-d H:i:s"); // $end = Yii::$app->formatter->asDatetime(strtotime("now"), "php:Y-m-d H:i:s");
$this->collection_money = Transfer::readPaid($start, $end, Yii::$app->user->id); $this->collection_money = Transfer::readPaidCash($start, $end, Yii::$app->user->id);
$this->non_cash_money = Transfer::readPaidNonCash($start, $end, Yii::$app->user->id);
} }
} }
@ -248,7 +245,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
public function hasDifferenceToPrevState(){ public function hasDifferenceToPrevState(){
$result = false; $result = false;
if ( $this->type == self::TYPE_CLOSE){ if ( $this->type == self::TYPE_CLOSE){
$result = ( $this->prev_money + $this->collection_money) != $this->money; /** @noinspection PhpUndefinedFieldInspection */
$result = ( $this->prev_money + $this->collection_money) != $this->money;
} }
return $result; return $result;
} }
@ -256,7 +254,8 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
public function hasPlus(){ public function hasPlus(){
$result = false; $result = false;
if ( $this->type == self::TYPE_CLOSE){ if ( $this->type == self::TYPE_CLOSE){
$result = ( $this->prev_money + $this->collection_money) < $this->money; /** @noinspection PhpUndefinedFieldInspection */
$result = ( $this->prev_money + $this->collection_money) < $this->money;
} }
return $result; return $result;
} }
@ -264,18 +263,21 @@ class AccountState extends \common\models\BaseFitnessActiveRecord
public function hasMinus(){ public function hasMinus(){
$result = false; $result = false;
if ( $this->type == self::TYPE_CLOSE){ if ( $this->type == self::TYPE_CLOSE){
$result =( $this->prev_money + $this->collection_money) > $this->money; /** @noinspection PhpUndefinedFieldInspection */
$result =( $this->prev_money + $this->collection_money) > $this->money;
} }
return $result; return $result;
} }
public function getSignedDiff(){ public function getSignedDiff(){
$result = $this->money - ( $this->prev_money + $this->collection_money); /** @noinspection PhpUndefinedFieldInspection */
$result = $this->money - ( $this->prev_money + $this->collection_money);
return $result; return $result;
} }
public function getExpected(){ public function getExpected(){
$result = $this->prev_money + $this->collection_money ; /** @noinspection PhpUndefinedFieldInspection */
$result = $this->prev_money + $this->collection_money ;
return $result; return $result;
} }

View File

@ -2,7 +2,8 @@
namespace common\models; namespace common\models;
use Yii; use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
Yii;
/** /**
* This is the model class for table "currency". * This is the model class for table "currency".
@ -14,7 +15,7 @@ use Yii;
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
*/ */
class Currency extends \common\models\BaseFitnessActiveRecord class Currency extends BaseFitnessActiveRecord
{ {
/** /**
* @inheritdoc * @inheritdoc
@ -54,8 +55,10 @@ class Currency extends \common\models\BaseFitnessActiveRecord
/** /**
* @param integer $money * @param integer $money
* @param common\models\Currency $currency * @param \common\models\Currency $currency
* */ *
* @return float
*/
public static function applyCurrency( $money,$currency ) { public static function applyCurrency( $money,$currency ) {
$result = $money / $currency; $result = $money / $currency;
return $result; return $result;

View File

@ -2,7 +2,8 @@
namespace common\models; namespace common\models;
use Yii; use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
Yii;
use yii\behaviors\TimestampBehavior; use yii\behaviors\TimestampBehavior;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
@ -18,6 +19,7 @@ use yii\helpers\ArrayHelper;
* @property integer $ticket_enabled * @property integer $ticket_enabled
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property mixed id_discount
*/ */
class Discount extends \yii\db\ActiveRecord class Discount extends \yii\db\ActiveRecord
{ {
@ -86,7 +88,7 @@ class Discount extends \yii\db\ActiveRecord
public function getStatusHuman(){ public function getStatusHuman(){
$result = null; $result = null;
$s = self::statuses($this->status); $s = self::statuses();
if ( array_key_exists($this->status, $s)){ if ( array_key_exists($this->status, $s)){
$result = $s[$this->status]; $result = $s[$this->status];
} }
@ -101,41 +103,59 @@ class Discount extends \yii\db\ActiveRecord
public function getTypeHuman(){ public function getTypeHuman(){
$result = null; $result = null;
$s = self::types($this->type); $s = self::types();
if ( array_key_exists($this->type, $s)){ if ( array_key_exists($this->type, $s)){
$result = $s[$this->type]; $result = $s[$this->type];
} }
return $result; return $result;
} }
public function getProcutEnabledHuman(){ /**
* @return string
*/
public function getProcutEnabledHuman(){
return $this->product_enabled == 1 ? 'Igen' : 'Nem'; return $this->product_enabled == 1 ? 'Igen' : 'Nem';
} }
public function getTicketEnabledHuman(){ /**
* @return string
*/
public function getTicketEnabledHuman(){
return $this->ticket_enabled == 1 ? 'Igen' : 'Nem'; return $this->ticket_enabled == 1 ? 'Igen' : 'Nem';
} }
public static function read(){ /**
* @return array|\yii\db\ActiveRecord[]
*/
public static function read(){
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE ])->all(); return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE ])->all();
} }
public static function readProductDiscounts(){ /**
* @return array|\yii\db\ActiveRecord[]
*/
public static function readProductDiscounts(){
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE , 'product_enabled' => 1 ])->all(); return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE , 'product_enabled' => 1 ])->all();
} }
public static function readTicketDiscounts(){ /**
* @return array|\yii\db\ActiveRecord[]
*/
public static function readTicketDiscounts(){
return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE , 'ticket_enabled' => 1 ])->all(); return Discount::find()->andWhere([ 'status' => self::STATUS_ACTIVE , 'ticket_enabled' => 1 ])->all();
} }
/** /**
* @param integer $money * @param integer $money
* @param common\models\Discount $discount * @param \common\models\Discount $discount
* */ *
* @return int
*/
public static function applyDiscount($money,$discount){ public static function applyDiscount($money,$discount){
$result = $money; /** @noinspection PhpUnusedLocalVariableInspection */
$result = $money;
$valueOfDiscount = floor( $money * $discount->value / 100 ); $valueOfDiscount = floor( $money * $discount->value / 100 );
$result = $money - $valueOfDiscount; $result = $money - $valueOfDiscount;
return $result; return $result;

View File

@ -29,6 +29,7 @@ use common\components\Helper;
* @property string $comment * @property string $comment
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property int id_contract
*/ */
class Ticket extends \common\models\BaseFitnessActiveRecord class Ticket extends \common\models\BaseFitnessActiveRecord
{ {
@ -133,7 +134,8 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
public function getCardNumber(){ public function getCardNumber(){
$result = ""; $result = "";
$card = $this->card; /** @noinspection PhpUndefinedFieldInspection */
$card = $this->card;
if ( isset($card)){ if ( isset($card)){
$result = $card->number; $result = $card->number;
} }
@ -146,7 +148,8 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
public function getCustomerName(){ public function getCustomerName(){
$result = ""; $result = "";
$customer = $this->customer; /** @noinspection PhpUndefinedFieldInspection */
$customer = $this->customer;
if ( isset($customer)){ if ( isset($customer)){
$result = $customer->name; $result = $customer->name;
} }
@ -171,23 +174,28 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
} }
public function getAccountName() { public function getAccountName() {
$result = ""; $result = "";
$account = $this->account; /** @noinspection PhpUndefinedFieldInspection */
/** @var \common\models\Account $account */
$account = $this->account;
if ( isset($account) ){ if ( isset($account) ){
$result = $this->account->name; $result = $account->name;
} }
return $result; return $result;
} }
public function getDiscountName() { public function getDiscountName() {
$result = ""; $result = "";
$discount = $this->discount; /** @noinspection PhpUndefinedFieldInspection */
/** @var \common\models\Discount $discount */
$discount = $this->discount;
if ( isset($discount) ){ if ( isset($discount) ){
$result = $this->discount->name; $result = $discount->name;
} }
return $result; return $result;
} }
public function getTicketTypeName() { public function getTicketTypeName() {
$result = ""; $result = "";
$ticketType = $this->ticketType; /** @noinspection PhpUndefinedFieldInspection */
$ticketType = $this->ticketType;
if ( isset($ticketType) ){ if ( isset($ticketType) ){
$result = $ticketType->name; $result = $ticketType->name;
} }
@ -195,7 +203,8 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
} }
public function getUserName() { public function getUserName() {
$result = ""; $result = "";
$user = $this->user; /** @noinspection PhpUndefinedFieldInspection */
$user = $this->user;
if ( isset($user) ){ if ( isset($user) ){
$result = $user->username; $result = $user->username;
} }
@ -203,9 +212,11 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
} }
/** /**
* @param common\models\Card $card the card to which we are looking for * @param \common\models\Card $card the card to which we are looking for
* */ *
* @return array|\yii\db\ActiveRecord[]
*/
public static function readActive($card){ public static function readActive($card){
if ( $card == null ) if ( $card == null )
@ -224,9 +235,12 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
return $result; return $result;
} }
/**
* @param common\models\Card $card the card to which we are looking for /**
* */ * @param \common\models\Card $card the card to which we are looking for
*
* @return array|\yii\db\ActiveRecord[]
*/
public static function readUnpaid($card){ public static function readUnpaid($card){
if ( $card == null ) if ( $card == null )
@ -326,7 +340,7 @@ class Ticket extends \common\models\BaseFitnessActiveRecord
/** /**
* Apply request * Apply request
* *
* @var common\models\TicketInstallmentRequest $request megbízás * @var \common\models\TicketInstallmentRequest $request megbízás
* */ * */
public function applyTicketInstallmentRequest( $request ) { public function applyTicketInstallmentRequest( $request ) {
//ha csoportos beszedéses //ha csoportos beszedéses

View File

@ -14,6 +14,7 @@ use yii\db\Query;
use yii\db\Expression; use yii\db\Expression;
use common\components\RoleDefinition; use common\components\RoleDefinition;
use common\components\Helper; use common\components\Helper;
use yii\web\NotAcceptableHttpException;
/** /**
* This is the model class for table "transfer". * This is the model class for table "transfer".
@ -37,6 +38,8 @@ use common\components\Helper;
* @property integer $direction * @property integer $direction
* @property string $paid_at * @property string $paid_at
* @property integer $id_customer * @property integer $id_customer
* @property int|string paid_by
* @property int payment_method
*/ */
class Transfer extends \common\models\BaseFitnessActiveRecord { class Transfer extends \common\models\BaseFitnessActiveRecord {
const TYPE_PRODUCT = 10; const TYPE_PRODUCT = 10;
@ -205,7 +208,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
} }
public function getPaidByName() { public function getPaidByName() {
$result = ""; $result = "";
$user = $this->paidByUser; /** @noinspection PhpUndefinedFieldInspection */
$user = $this->paidByUser;
if (isset ( $this->paidByUser )) { if (isset ( $this->paidByUser )) {
$result = $user->username; $result = $user->username;
} }
@ -215,17 +219,21 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
public function getObjectName() { public function getObjectName() {
$result = ""; $result = "";
if ($this->type == Transfer::TYPE_TICKET) { if ($this->type == Transfer::TYPE_TICKET) {
$result = $this->ticketName; /** @noinspection PhpUndefinedFieldInspection */
$result = $this->ticketName;
} else if ($this->type == Transfer::TYPE_PRODUCT) { } else if ($this->type == Transfer::TYPE_PRODUCT) {
$result = $this->productName; /** @noinspection PhpUndefinedFieldInspection */
$result = $this->productName;
} else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) { } else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
$result = $this->moneyMovement->humanType; /** @noinspection PhpUndefinedFieldInspection */
$result = $this->moneyMovement->humanType;
} }
return $result; return $result;
} }
public function getUserName() { public function getUserName() {
$result = ""; $result = "";
$user = $this->user; /** @noinspection PhpUndefinedFieldInspection */
$user = $this->user;
if (isset ( $this->user )) { if (isset ( $this->user )) {
$result = $user->username; $result = $user->username;
} }
@ -234,7 +242,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
} }
public function getProductName() { public function getProductName() {
$result = ""; $result = "";
$product = $this->product; /** @noinspection PhpUndefinedFieldInspection */
$product = $this->product;
if (isset ( $product )) { if (isset ( $product )) {
$result = $product->name; $result = $product->name;
} }
@ -243,16 +252,20 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
} }
public function getTicketName() { public function getTicketName() {
$result = ""; $result = "";
$ticket = $this->ticket; /** @noinspection PhpUndefinedFieldInspection */
/** @var \common\models\Ticket $ticket */
$ticket = $this->ticket;
if (isset ( $ticket )) { if (isset ( $ticket )) {
$result = $this->ticket->ticketTypeName; /** @noinspection PhpUndefinedFieldInspection */
$result = $this->ticket->ticketTypeName;
} }
return $result; return $result;
} }
public function getAccountName() { public function getAccountName() {
$result = ""; $result = "";
$account = $this->account; /** @noinspection PhpUndefinedFieldInspection */
$account = $this->account;
if (isset ( $account )) { if (isset ( $account )) {
$result = $account->name; $result = $account->name;
} }
@ -272,7 +285,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
} }
public function getSaleName() { public function getSaleName() {
$result = ""; $result = "";
$sale = $this->sale; /** @noinspection PhpUndefinedFieldInspection */
$sale = $this->sale;
if (isset ( $sale )) { if (isset ( $sale )) {
$result = $sale->name; $result = $sale->name;
} }
@ -305,22 +319,27 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
$s .= $this->count; $s .= $this->count;
$s .= " " . Yii::t ( 'frontend/transfer', 'pieces' ) . " "; $s .= " " . Yii::t ( 'frontend/transfer', 'pieces' ) . " ";
$s .= $this->product->name; /** @noinspection PhpUndefinedFieldInspection */
$s .= $this->product->name;
$s .= " - "; $s .= " - ";
$s .= $this->account->name; /** @noinspection PhpUndefinedFieldInspection */
$s .= $this->account->name;
return $s; return $s;
} }
/** /**
* *
* @param $account common\models\Account * @param $sale
* @param $discount common\models\Discount * @param $account \common\models\Account
* @param $currency common\models\Currency * @param $discount \common\models\Discount
* @param $product common\models\Product * @param $currency \common\models\Currency
* @param $customer common\models\Customer * @param $count
* * @param $product \common\models\Product
*/ * @param int $status
* @param $customer \common\models\Customer
* @return Transfer
*/
public static function createProductTransfer($sale, $account, $discount, $currency, $count, $product, $status = Transfer::STATUS_PAID, $customer = null) { public static function createProductTransfer($sale, $account, $discount, $currency, $count, $product, $status = Transfer::STATUS_PAID, $customer = null) {
$transfer = new Transfer (); $transfer = new Transfer ();
@ -334,7 +353,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
$transfer->count = $count; $transfer->count = $count;
$totalPrice = $totalPrice * $count; $totalPrice = $totalPrice * $count;
if (isset ( $discount )) { /** @var \common\models\Discount $discount */
if (isset ( $discount )) {
$transfer->id_discount = $discount->id_discount; $transfer->id_discount = $discount->id_discount;
$totalPrice = Discount::applyDiscount ( $totalPrice, $discount ); $totalPrice = Discount::applyDiscount ( $totalPrice, $discount );
} }
@ -358,14 +378,14 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $transfer; return $transfer;
} }
/** /**
* *
* @param $account common\models\Account * @param $account \common\models\Account
* @param $discount common\models\Discount * @param $moneyMovement \common\models\MoneyMovement
* @param $currency common\models\Currency * @return Transfer
* @param $moneyMovement common\models\MoneyMovement * @internal param Discount $discount
* * @internal param Currency $currency
*/ */
public static function createMoneyMovementOutTransfer($account, $moneyMovement) { public static function createMoneyMovementOutTransfer($account, $moneyMovement) {
$transfer = new Transfer (); $transfer = new Transfer ();
$transfer->payment_method = Transfer::PAYMENT_METHOD_CASH; $transfer->payment_method = Transfer::PAYMENT_METHOD_CASH;
@ -388,14 +408,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $transfer; return $transfer;
} }
/**
* /**
* @param $account common\models\Account *
* @param $discount common\models\Discount * @param $account \common\models\Account
* @param $currency common\models\Currency * @param $discount \common\models\Discount
* @param $ticket common\models\Ticket * @param $currency \common\models\Currency
* * @param $count int
*/ * @param $ticket \common\models\Ticket
*
* @param int $status
* @return Transfer
*/
public static function createTicketTransfer($account, $discount, $currency, $count, $ticket, $status = Transfer::STATUS_NOT_PAID) { public static function createTicketTransfer($account, $discount, $currency, $count, $ticket, $status = Transfer::STATUS_NOT_PAID) {
$transfer = new Transfer (); $transfer = new Transfer ();
@ -412,15 +436,17 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
$totalPrice = $totalPrice * $count; $totalPrice = $totalPrice * $count;
if (isset ( $discount )) { if (isset ( $discount )) {
/** @var \common\models\Discount $discount */
$transfer->id_discount = $discount->id_discount; $transfer->id_discount = $discount->id_discount;
$totalPrice = Discount::applyDiscount ( $totalPrice, $discount ); $totalPrice = Discount::applyDiscount ( $totalPrice, $discount );
} }
$transfer->money = $totalPrice; $transfer->money = $totalPrice;
if (isset ( $currency )) { if (isset ( $currency )) {
$transfer->rate = $currency->rate; $transfer->rate = $currency->rate;
$transfer->money_currency = Currency::applyCurrency ( $totalPrice, $currency ); /** @var \common\models\Currency $currency */
$transfer->money_currency = Currency::applyCurrency ( $totalPrice, $currency );
} }
$transfer->id_account = $account->id_account; $transfer->id_account = $account->id_account;
@ -464,6 +490,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
} else if ($transfer->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) { } else if ($transfer->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
return "Pénzmozgás"; return "Pénzmozgás";
} }
return "-";
} }
] ]
] ); ] );
@ -490,8 +517,6 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $result; return $result;
} }
public static function readUserSoldTransfers($user) { public static function readUserSoldTransfers($user) {
$transfers = [ ];
$query = Transfer::find (); $query = Transfer::find ();
$query->innerJoin ( "user_sold_item", "user_sold_item.id_transfer = transfer.id_transfer" ); $query->innerJoin ( "user_sold_item", "user_sold_item.id_transfer = transfer.id_transfer" );
@ -501,9 +526,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
'user_sold_item.id_user' => $user->id 'user_sold_item.id_user' => $user->id
] ); ] );
} }
$transfers = $query->all (); return $query->all ();
return $transfers;
} }
public static function readCustomerCart($customer) { public static function readCustomerCart($customer) {
$transfers = [ ]; $transfers = [ ];
@ -573,16 +597,20 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
public function beforeDelete() { public function beforeDelete() {
parent::beforeDelete (); parent::beforeDelete ();
if ($this->type == Transfer::TYPE_TICKET) { if ($this->type == Transfer::TYPE_TICKET) {
$ticket = $this->ticket; /** @noinspection PhpUndefinedFieldInspection */
$ticket = $this->ticket;
if ($ticket != null) { if ($ticket != null) {
$ticket->delete (); $ticket->delete ();
} }
} else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) { } else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
$mm = $this->moneyMovement; /** @noinspection PhpUndefinedFieldInspection */
$mm = $this->moneyMovement;
$mm->delete (); $mm->delete ();
} else if ($this->type == Transfer::TYPE_PRODUCT) { } else if ($this->type == Transfer::TYPE_PRODUCT) {
$sale = $this->sale; /** @noinspection PhpUndefinedFieldInspection */
$product = $this->product; $sale = $this->sale;
/** @noinspection PhpUndefinedFieldInspection */
$product = $this->product;
$product->stock = $product->stock + $this->count; $product->stock = $product->stock + $this->count;
@ -600,38 +628,44 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return true; return true;
} }
/** /**
* *
* @param string $mode * @param string $mode
* The mode to load * The mode to load
* Available modes * Available modes
* <ul> * <ul>
* <li> * <li>
* <h2>created_at</h2> * <h2>created_at</h2>
* <p>Load all transfer which were created </p> * <p>Load all transfer which were created </p>
* </li> * </li>
* <li> * <li>
* <h2>paid_at</h2> * <h2>paid_at</h2>
* <p>Load all transfer which were paid </p> * <p>Load all transfer which were paid </p>
* </li> * </li>
* <li> * <li>
* <h2>created_at_paid</h2> * <h2>created_at_paid</h2>
* <p>Load all transfer which were created and paid </p> * <p>Load all transfer which were created and paid </p>
* </li> * </li>
* <li> * <li>
* <h2>created_at_not_paid</h2> * <h2>created_at_not_paid</h2>
* <p>Load all transfer which were created but not paid </p> * <p>Load all transfer which were created but not paid </p>
* </li> * </li>
* <li> * <li>
* <h2>paid_at_not_created_at</h2> * <h2>paid_at_not_created_at</h2>
* <p>Load all transfer which were not created but paid . Works correctly only, * <p>Load all transfer which were not created but paid . Works correctly only,
* when start and end date given * when start and end date given
* </p> * </p>
* </li> * </li>
* </ul> * </ul>
* *
* *
*/ * @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @return Query
*/
public static function mkTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) { public static function mkTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) {
$query = new Query (); $query = new Query ();
@ -698,7 +732,14 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $query; return $query;
} }
public static function notInInterval($query, $field, $start, $end) {
/**
* @param \yii\db\Query $query
* @param string $field
* @param string $start
* @param string $end
*/
public static function notInInterval($query, $field, $start, $end) {
$query->andFilterWhere ( [ $query->andFilterWhere ( [
'or', 'or',
[ [
@ -713,7 +754,14 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
] ]
] ); ] );
} }
public static function notPaid($query, $field, $start, $end) {
/**
* @param \yii\db\Query $query
* @param string $field
* @param string $start
* @param string $end
*/
public static function notPaid($query, $field, $start, $end) {
$query->andFilterWhere ( [ $query->andFilterWhere ( [
'or', 'or',
[ [
@ -731,7 +779,14 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
] ]
] ); ] );
} }
public static function inInterval($query, $field, $start, $end) {
/**
* @param \yii\db\Query $query
* @param string $field
* @param string $start
* @param string $end
*/
public static function inInterval($query, $field, $start, $end) {
$query->andFilterWhere ( [ $query->andFilterWhere ( [
'>=', '>=',
$field, $field,
@ -744,14 +799,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
] ); ] );
} }
/** /**
* *
* Parse query results so, that all available account will be display, even then , if $queryResult does not contain any result for the given account * Parse query results so, that all available account will be display, even then , if $queryResult does not contain any result for the given account
* *
* @param mixed $queryResult * @param mixed $queryResult
* an array, wchic contains items. each item has to key - value pairs: [ id_account => 0, money => 0 ] * an array, wchic contains items. each item has to key - value pairs: [ id_account => 0, money => 0 ]
* *
*/ * @param $accounts
* @param $accountMap
* @param $idAccount
* @return array
*/
public static function mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount) { public static function mkTotalsResultWithAllAvailableAccount($queryResult, $accounts, $accountMap, $idAccount) {
$totals = [ ]; $totals = [ ];
$totals ['total'] = 0; $totals ['total'] = 0;
@ -790,9 +849,16 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $result; return $result;
} }
/** /**
* create and execute a "total" query * create and execute a "total" query
*/ * @param $mode
* @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @return array
*/
public static function exTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) { public static function exTotalQuery($mode, $start, $end, $idUser, $types, $idAccount) {
$query = self::mkTotalQuery ( $mode, $start, $end, $idUser, $types, $idAccount ); $query = self::mkTotalQuery ( $mode, $start, $end, $idUser, $types, $idAccount );
$command = $query->createCommand (); $command = $query->createCommand ();
@ -800,11 +866,20 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $result; return $result;
} }
/** /**
* find all transfers which were paid in the period * find all transfers which were paid in the period
*/ * @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @param $accounts
* @param $accountMap
* @return array
*/
public static function mkPaidAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) { public static function mkPaidAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
$result = [ ]; /** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'paid_at', $start, $end, $idUser, $types, $idAccount ); $queryResult = self::exTotalQuery ( 'paid_at', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount ); $result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
return $result; return $result;
@ -814,7 +889,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* find all transfers in the period ( doesn't matter if paid or not ) * find all transfers in the period ( doesn't matter if paid or not )
*/ */
public static function mkCreatedAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) { public static function mkCreatedAtTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
$result = [ ]; /** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'created_at', $start, $end, $idUser, $types, $idAccount ); $queryResult = self::exTotalQuery ( 'created_at', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount ); $result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
return $result; return $result;
@ -824,7 +900,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* find transfers which were created but not paid in the period * find transfers which were created but not paid in the period
*/ */
public static function mkCreatedAtNotPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) { public static function mkCreatedAtNotPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
$result = [ ]; /** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'created_at_not_paid', $start, $end, $idUser, $types, $idAccount ); $queryResult = self::exTotalQuery ( 'created_at_not_paid', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount ); $result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
return $result; return $result;
@ -834,17 +911,27 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
* find transfers which were created and paid in the period * find transfers which were created and paid in the period
*/ */
public static function mkCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) { public static function mkCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
$result = [ ]; /** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'created_at_paid', $start, $end, $idUser, $types, $idAccount ); $queryResult = self::exTotalQuery ( 'created_at_paid', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount ); $result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
return $result; return $result;
} }
/** /**
* find transfers, where depth was paid * find transfers, where depth was paid
*/ * @param $start
* @param $end
* @param $idUser
* @param $types
* @param $idAccount
* @param $accounts
* @param $accountMap
* @return array
*/
public static function mkPaidAtNotCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) { public static function mkPaidAtNotCreatedAtPaidTotals($start, $end, $idUser, $types, $idAccount, $accounts, $accountMap) {
$result = [ ]; /** @noinspection PhpUnusedLocalVariableInspection */
$result = [ ];
$queryResult = self::exTotalQuery ( 'paid_at_not_created_at', $start, $end, $idUser, $types, $idAccount ); $queryResult = self::exTotalQuery ( 'paid_at_not_created_at', $start, $end, $idUser, $types, $idAccount );
$result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount ); $result = self::mkTotalsResultWithAllAvailableAccount ( $queryResult, $accounts, $accountMap, $idAccount );
return $result; return $result;
@ -861,16 +948,20 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
return $result; return $result;
} }
/** /**
* Ezt a függvényt használjuk a zárások összegének kiszámolására! * Ezt a függvényt használjuk a zárások összegének kiszámolására!
* A számolás csak a következő feltételekkel bíró tranzakciókat * A számolás csak a következő feltételekkel bíró tranzakciókat
* tartalmazza: * tartalmazza:
* - trazakció típus: common\models\Account::TYPE_ALL * - trazakció típus: common\models\Account::TYPE_ALL
* - tranzakció fizetési módja: készpénz * - tranzakció fizetési módja: készpénz
* - tranzakció státusza: fizetve * - tranzakció státusza: fizetve
* - * -
*/ * @param $start
public static function readPaid($start, $end, $idUser) { * @param $end
* @param $idUser
* @return bool|string
*/
public static function readPaidCash($start, $end, $idUser) {
$query = (new \yii\db\Query ()); $query = (new \yii\db\Query ());
$query->select ( [ $query->select ( [
'coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN . ' then transfer.money else -1 * transfer.money end ),0) AS transfer_money' 'coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN . ' then transfer.money else -1 * transfer.money end ),0) AS transfer_money'
@ -881,50 +972,34 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
'transfer.paid_by' => $idUser 'transfer.paid_by' => $idUser
] ); ] );
$created_condition = [ $created_condition = [
'and', 'and',
[ [ '>=', 'transfer.created_at', $start ],
'>=', [ '<', 'transfer.created_at', $end ]
'transfer.created_at',
$start
],
[
'<',
'transfer.created_at',
$end
]
];
$paid_condition = [
'and',
[
'>=',
'transfer.paid_at',
$start
],
[
'<',
'transfer.paid_at',
$end
]
]; ];
$query->andFilterWhere ( [ $paid_condition = [
'and',
[ '>=', 'transfer.paid_at', $start ],
[ '<', 'transfer.paid_at', $end ]
];
$query->andFilterWhere ( [
'or', 'or',
$created_condition, $created_condition,
$paid_condition $paid_condition
] ); ] );
$query->andWhere ( [
'transfer.status' => Transfer::STATUS_PAID $query->andWhere ( [
] ); 'transfer.status' => Transfer::STATUS_PAID,
$query->andWhere ( [ 'account.type' => Account::TYPE_ALL ,
'account.type' => Account::TYPE_ALL
] );
$query->andWhere ( [
'transfer.payment_method' => Transfer::PAYMENT_METHOD_CASH 'transfer.payment_method' => Transfer::PAYMENT_METHOD_CASH
] ); ] );
return $query->scalar (); return $query->scalar ();
} }
public function storno() { public function storno() {
$this->status = Transfer::STATUS_STORNO; $this->status = Transfer::STATUS_STORNO;
$this->save ( false ); $this->save ( false );
@ -944,14 +1019,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
// storno contract // storno contract
} else if ($this->type == Transfer::TYPE_PRODUCT) { } else if ($this->type == Transfer::TYPE_PRODUCT) {
$sale = $this->sale; /** @noinspection PhpUndefinedFieldInspection */
$product = $this->sale->product; $sale = $this->sale;
/** @noinspection PhpUndefinedFieldInspection */
/** @var \common\models\Product $product */
$product = $this->sale->product;
$product->stock = $product->stock + $this->count; $product->stock = $product->stock + $this->count;
$product->save ( false ); $product->save ( false );
$sale->status = Sale::STATUS_DELETED; $sale->status = Sale::STATUS_DELETED;
$sale->save ( false ); $sale->save ( false );
} else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) { } else if ($this->type == Transfer::TYPE_MONEY_MOVEMENT_OUT) {
$mm = $this->moneyMovement; /** @noinspection PhpUndefinedFieldInspection */
$mm = $this->moneyMovement;
$mm->status = MoneyMovement::STATUS_STORNO; $mm->status = MoneyMovement::STATUS_STORNO;
$mm->save ( false ); $mm->save ( false );
} }
@ -963,7 +1042,11 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
'id_transfer' => $this->id_transfer 'id_transfer' => $this->id_transfer
] ); ] );
} }
public function unstorono() {
/**
* @throws \yii\web\NotAcceptableHttpException
*/
public function unstorono() {
if ($this->type != Transfer::TYPE_TICKET) { if ($this->type != Transfer::TYPE_TICKET) {
throw new NotAcceptableHttpException ( "Csak bérletet lehet visszaállítani" ); throw new NotAcceptableHttpException ( "Csak bérletet lehet visszaállítani" );
} }
@ -991,6 +1074,51 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
} }
/**
* @param $start $start date
* @param $end $end date
* @param $idUser $user
* @return bool|string
*/
public static function readPaidNonCash($start, $end, $idUser) {
$query = (new Query());
$query->select ( [
'coalesce(sum( case when transfer.direction = ' . Transfer::DIRECTION_IN . ' then transfer.money else -1 * transfer.money end ),0) AS transfer_money'
] );
$query->from ( 'transfer' );
$query->innerJoin ( "account", "account.id_account = transfer.id_account" );
$query->andWhere ( [
'transfer.paid_by' => $idUser
] );
$created_condition = [
'and',
[ '>=', 'transfer.created_at', $start ],
[ '<', 'transfer.created_at', $end ]
];
$paid_condition = [
'and',
[ '>=', 'transfer.paid_at', $start ],
[ '<', 'transfer.paid_at', $end ]
];
$query->andFilterWhere ( [
'or',
$created_condition,
$paid_condition
] );
$query->andWhere ( [
'transfer.status' => Transfer::STATUS_PAID,
'account.type' => Account::TYPE_ALL
] );
$query->andWhere(['<>' ,'transfer.payment_method', Transfer::PAYMENT_METHOD_CASH ]);
return $query->scalar ();
}
public function payout($id_account = null) { public function payout($id_account = null) {
if ($this->status != Transfer::STATUS_NOT_PAID) { if ($this->status != Transfer::STATUS_NOT_PAID) {

View File

@ -0,0 +1,30 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m161004_062500_alter__table__account_state_add_column_non_cash_money extends Migration
{
public function up()
{
$this->addColumn("account_state", "non_cash_money", "int default 0");
}
public function down()
{
echo "m161004_062500_alter__table__account_state_add_column_non_cash_money cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -4,7 +4,8 @@ namespace frontend\controllers;
use common\components\DateUtil; use common\components\DateUtil;
use frontend\models\AccountstateSearchToday; use frontend\models\AccountstateSearchToday;
use Yii; use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
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;
@ -201,7 +202,7 @@ class AccountStateController extends Controller {
$total += $cassaOpen->money; $total += $cassaOpen->money;
$openDate = $cassaOpen->created_at; $openDate = $cassaOpen->created_at;
} }
$total += Transfer::readPaid($openDate, date('Y-m-d H:i:s'), \Yii::$app->user->id); $total += Transfer::readPaidCash($openDate, date('Y-m-d H:i:s'), \Yii::$app->user->id);
return $total; return $total;
} }
@ -227,41 +228,7 @@ class AccountStateController extends Controller {
throw new NotFoundHttpException ( 'The requested page does not exist.' ); throw new NotFoundHttpException ( 'The requested page does not exist.' );
} }
} }
/**
* Creates a new AccountState model.
* If creation is successful, the browser will be redirected to the 'view' page.
*
* @return mixed public function actionCreate()
* {
* $model = new AccountState();
*
* if ($model->load(Yii::$app->request->post()) && $model->save()) {
* return $this->redirect(['view', 'id' => $model->id_account_state]);
* } else {
* return $this->render('create', [
* 'model' => $model,
* ]);
* }
* }
*/
/**
* Updates an existing AccountState model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
* @return mixed public function actionUpdate($id)
* {
* $model = $this->findModel($id);
*
* if ($model->load(Yii::$app->request->post()) && $model->save()) {
* return $this->redirect(['view', 'id' => $model->id_account_state]);
* } else {
* return $this->render('update', [
* 'model' => $model,
* ]);
* }
* }
*/
/** /**
* Deletes an existing AccountState model. * Deletes an existing AccountState model.
* If deletion is successful, the browser will be redirected to the 'index' page. * If deletion is successful, the browser will be redirected to the 'index' page.
@ -321,7 +288,8 @@ class AccountStateController extends Controller {
$mpdf->useSubstitutions=false; $mpdf->useSubstitutions=false;
$mpdf->simpleTables = true; $mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) ); $mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
$mpdf->setFooter('{PAGENO} / {nb}'); /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
$mpdf->setFooter('{PAGENO} / {nb}');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css $stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
$mpdf->WriteHTML($stylesheet,1); $mpdf->WriteHTML($stylesheet,1);
@ -331,10 +299,12 @@ class AccountStateController extends Controller {
'model' => $accountState, 'model' => $accountState,
'details' => $details 'details' => $details
])); ]));
/** @noinspection SpellCheckingInspection */
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras"; $type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username; $dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf"; $fn= $type .$dt.".pdf";
$mpdf->Output($fn, 'D'); $mpdf->Output($fn, 'D');
exit(0);
} else { } else {
@ -378,6 +348,7 @@ class AccountStateController extends Controller {
$mpdf->useSubstitutions=false; $mpdf->useSubstitutions=false;
$mpdf->simpleTables = true; $mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) ); $mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
/** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
$mpdf->setFooter('{PAGENO} / {nb}'); $mpdf->setFooter('{PAGENO} / {nb}');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css $stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
@ -391,6 +362,7 @@ class AccountStateController extends Controller {
'model' => $accountState, 'model' => $accountState,
'details' => $details 'details' => $details
])); ]));
/** @noinspection SpellCheckingInspection */
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras"; $type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username; $dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf"; $fn= $type .$dt.".pdf";