add non cash money display to account state

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

View File

@@ -4,7 +4,8 @@ namespace frontend\controllers;
use common\components\DateUtil;
use frontend\models\AccountstateSearchToday;
use Yii;
use /** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
Yii;
use common\models\AccountState;
use frontend\models\AccountstateSearch;
use yii\web\Controller;
@@ -201,7 +202,7 @@ class AccountStateController extends Controller {
$total += $cassaOpen->money;
$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;
}
@@ -227,41 +228,7 @@ class AccountStateController extends Controller {
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.
* 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->simpleTables = true;
$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
$mpdf->WriteHTML($stylesheet,1);
@@ -331,10 +299,12 @@ class AccountStateController extends Controller {
'model' => $accountState,
'details' => $details
]));
/** @noinspection SpellCheckingInspection */
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf";
$mpdf->Output($fn, 'D');
exit(0);
} else {
@@ -378,6 +348,7 @@ class AccountStateController extends Controller {
$mpdf->useSubstitutions=false;
$mpdf->simpleTables = true;
$mpdf->SetHeader( \Yii::$app->params[ "company_name" ] . " - Létrehozva: " .$user->username . ", ".\Yii::$app->formatter->asDatetime(time()) );
/** @noinspection PhpMethodOrClassCallIsNotCaseSensitiveInspection */
$mpdf->setFooter('{PAGENO} / {nb}');
$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,
'details' => $details
]));
/** @noinspection SpellCheckingInspection */
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf";