Finish account_close_view

This commit is contained in:
Roland Schneider 2016-03-04 21:53:53 +01:00
commit 992945f4ac
18 changed files with 360 additions and 17 deletions

View File

@ -1,3 +1,6 @@
-0.0.49
- contract - add started_at
- receptions/account-state/mixed
-0.0.48 -0.0.48
- add payment method display to backend/transfer/index - add payment method display to backend/transfer/index
- add footer money display to backend/transfer/index - add footer money display to backend/transfer/index

View File

@ -135,6 +135,17 @@ class DailyListing
return $days_between > $days_visiblity; return $days_between > $days_visiblity;
} }
/**
* cutler győr-ben a nap záráshoz ezt nyomtatjuk ki
* Ez a metódus csak akkor használható, ha csak ez a statisztika kell
* */
public function readMixed(){
$this->readProductsByCategory();
$this->readTicketStas();
$this->readMoneyMovements();
}
public function readTotalEasy(){ public function readTotalEasy(){
$this->readTicketMoney(); $this->readTicketMoney();
$this->readProductsMoney(); $this->readProductsMoney();

View File

@ -254,6 +254,13 @@ class Helper {
public static function fixAsciiChars($in) { public static function fixAsciiChars($in) {
$out = str_replace ( "ö", "0", $in ); $out = str_replace ( "ö", "0", $in );
$out = str_replace ( "Ö", "0", $out ); $out = str_replace ( "Ö", "0", $out );
/*
$out = str_replace ( "Y", "%", $out );
$out = str_replace ( "y", "%", $out );
$out = str_replace ( "Z", "y", $out );
$out = str_replace ( "z", "y", $out );
$out = str_replace ( "%", "y", $out );
*/
return $out; return $out;
} }
public static function isUserCartVisibilityUser() { public static function isUserCartVisibilityUser() {
@ -361,7 +368,7 @@ class Helper {
return $result; return $result;
} }
public static function generateRandomString($length = 6,$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ) { public static function generateRandomString($length = 6,$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWX' ) {
$charactersLength = strlen($characters); $charactersLength = strlen($characters);
$randomString = ''; $randomString = '';
for ($i = 0; $i < $length; $i++) { for ($i = 0; $i < $length; $i++) {

View File

@ -40,7 +40,8 @@ class AccountStateWidget extends Widget{
'user.username', 'user.username',
[ [
'attribute' => 'created_at', 'attribute' => 'created_at',
'label' => 'Nyitás ideje' 'label' => 'Nyitás ideje',
'format' => 'datetime'
], ],
]; ];
}else{ }else{
@ -61,11 +62,13 @@ class AccountStateWidget extends Widget{
'user.username', 'user.username',
[ [
'attribute' => 'start_date', 'attribute' => 'start_date',
'label' => 'Előző nyitás ideje' 'label' => 'Előző nyitás ideje' ,
'format' => 'datetime'
], ],
[ [
'attribute' => 'created_at', 'attribute' => 'created_at',
'label' => 'Zárás ideje' 'label' => 'Zárás ideje',
'format' => 'datetime'
], ],
]; ];
} }
@ -74,6 +77,7 @@ class AccountStateWidget extends Widget{
echo DetailView::widget([ echo DetailView::widget([
'options' => ['class' => 'table table-striped table-bordered detail-view table-account-view'] ,
'model' => $this->model, 'model' => $this->model,
'attributes' =>$attributes, 'attributes' =>$attributes,
]) ; ]) ;

View File

@ -27,6 +27,7 @@ class TotalDifferenceWidget extends Widget{
$ft = " Ft"; $ft = " Ft";
$s .= DetailView::widget([ $s .= DetailView::widget([
'options' => ['class' => 'table table-striped table-bordered detail-view table-account-diff'],
'model' => $this->model, 'model' => $this->model,
'template' =>"<tr><th>{label}</th><td style='text-align: right;'>{value} </td></tr>", 'template' =>"<tr><th>{label}</th><td style='text-align: right;'>{value} </td></tr>",
'attributes' => [ 'attributes' => [

View File

@ -0,0 +1,9 @@
<?php
namespace common\components\total;
class TotalProductsByCategoryWidget extends TotalBaseWidget{
public $viewFile = 'total_product_by_category.php';
}

View File

@ -4,7 +4,7 @@ return [
'supportEmail' => 'rocho02@gmail.com', 'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu', 'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.48', 'version' => 'v0.0.49',
'company' => 'movar',//gyor 'company' => 'movar',//gyor
'company_name' => "Freimann Kft.", 'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global 'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@ -1,5 +1,4 @@
<h3>Pénzmozgások</h3> <table class="table table-bordered table-striped table-summary table-money-movements-detailed">
<table class="table table-bordered table-striped table-summary">
<thead> <thead>
<tr> <tr>
<th>Dátum</th> <th>Dátum</th>
@ -7,20 +6,20 @@
<th>Felhasználó</th> <th>Felhasználó</th>
<th>Név</th> <th>Név</th>
<th>Típus</th> <th>Típus</th>
<th>Összeg</th>
<th>Megjegyzés</th> <th>Megjegyzés</th>
<th>Összeg</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach ($model->moneyMovements as $p ){?> <?php foreach ($model->moneyMovements as $p ){?>
<tr> <tr>
<td><?php echo $p['money_movement_created_at']?> </td> <td class="created-at"><?php echo $p['money_movement_created_at']?> </td>
<td><?php echo $p['account_name']?> </td> <td class="account"><?php echo $p['account_name']?> </td>
<td><?php echo $p['user_name']?> </td> <td class="username"><?php echo $p['user_name']?> </td>
<td><?php echo $p['money_movement_name'] ?></td> <td class="name"><?php echo $p['money_movement_name'] ?></td>
<td><?php echo $p['money_movement_type_name'] ?></td> <td class="type"><?php echo $p['money_movement_type_name'] ?></td>
<td class="comment"><?php echo $p['money_movement_comment'] ?></td>
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['signed_money'])?> Ft</td> <td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['signed_money'])?> Ft</td>
<td><?php echo $p['money_movement_comment'] ?></td>
</tr> </tr>
<?php } ?> <?php } ?>

View File

@ -1,4 +1,4 @@
<table class="table table-bordered table-striped table-summary"> <table class="table table-bordered table-striped table-summary total-medium-ticket">
<thead> <thead>
<tr> <tr>
<th>Bérlet típus</th> <th>Bérlet típus</th>

View File

@ -0,0 +1,37 @@
<?php
$categories = $model->productMoneies;
?>
<table
class="table table-bordered table-striped table-summary total-product-by-category">
<thead>
<tr>
<th>Kategória</th>
<th>Mennyiség</th>
<th>Összeg</th>
</tr>
</thead>
<tbody>
<?php foreach ( $categories as $p){?>
<tr>
<td class='name'><?php echo $p['category_name'] ?></td>
<td class='count'><?php echo $p['category_count'] ?> Db</td>
<td class='money'><?php echo \Yii::$app->formatter->asInteger( $p['product_money'])?> FT</td>
</tr>
<?php }?>
</tbody>
</table>
<?php
?>
<div class="row">
<div class="col-md-12 text-right" style="text-decoration: underline;">
Összesen:
<?php
echo \Yii::$app->formatter->asInteger( $model->productsByCategory ['total']);
?> Ft
</div>
</div>

View File

@ -59,6 +59,14 @@ class AccountStateBanknoteCountWidget extends Widget{
$s .= Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt']) ."&nbsp;Pdf", Url::to([ 'view', 'id' =>$this->model->id_account_state, 'output' =>'pdf']) ,['class' => 'btn btn-primary btn-pdf','style' =>'margin-bottom: 12px; margin-right: 6px;']); $s .= Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt']) ."&nbsp;Pdf", Url::to([ 'view', 'id' =>$this->model->id_account_state, 'output' =>'pdf']) ,['class' => 'btn btn-primary btn-pdf','style' =>'margin-bottom: 12px; margin-right: 6px;']);
if ( $this->model->isTypeClose() ){
$s .= Html::a('<span class="glyphicon glyphicon-eye-open"></span>&nbsp;Napi összefoglaló', Url::toRoute(['mixed','id' =>$this->model->id_account_state]), [
'title' => 'Napi összefoglaló',
'class' => 'btn btn-success',
'style' =>'margin-bottom: 12px; margin-right: 6px;'
]);
}
$s .= Html::a('<span class="glyphicon glyphicon-eye-open"></span>&nbsp;Részletek', Url::toRoute(['view','id' =>$this->model->id_account_state]), [ $s .= Html::a('<span class="glyphicon glyphicon-eye-open"></span>&nbsp;Részletek', Url::toRoute(['view','id' =>$this->model->id_account_state]), [
'title' => 'Részletek', 'title' => 'Részletek',
'class' => 'btn btn-success', 'class' => 'btn btn-success',

View File

@ -27,7 +27,8 @@ class AccountStateController extends Controller {
'index', 'index',
'open', 'open',
'close', 'close',
'view' 'view' ,
'mixed'
], ],
'rules' => [ 'rules' => [
// allow authenticated users // allow authenticated users
@ -301,4 +302,63 @@ class AccountStateController extends Controller {
] ); ] );
} }
} }
public function actionMixed($id){
$accountState = $this->findModel ( $id );
$output = Yii::$app->getRequest ()->getQueryParam ( 'output' );
$details = null;
if ($accountState->isTypeClose ()) {
$prev;
if ($accountState->type == AccountState::TYPE_CLOSE) {
if (isset ( $accountState->prev_state )) {
$prev = AccountState::findOne ( $accountState->prev_state );
}
if (isset ( $prev )) {
$accountState->start_date = $prev->created_at;
}
}
$details = new DailyListing ();
$details->loadAccountState ( $accountState );
$details->readTotalEasy ();
$details->readTotalDetailed ();
$details->readTotalMedium ();
}
if ($output == 'pdf') {
$user = User::findOne(\Yii::$app->user->id);
$mpdf=new \mPDF('utf-8', 'A4');
$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}');
$stylesheet = file_get_contents( \Yii::getAlias('@vendor'.'/bower/bootstrap/dist/css/bootstrap.css')); // external css
$mpdf->WriteHTML($stylesheet,1);
$stylesheet = file_get_contents( \Yii::getAlias('@frontend'.'/web/css/account_close.css')); // external css
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($this->renderPartial("@frontend/views/account-state/mixed_pdf", [
'model' => $accountState,
'details' => $details
]));
$type = $accountState->isTypeOpen() ? "kassza_nyitas" : "kassza_zaras";
$dt= "_letrehozva_".date("Ymd_His"). "_" . $user->username;
$fn= $type .$dt.".pdf";
$mpdf->Output($fn, 'D');
exit();
}
return $this->render ( 'mixed', [
'model' => $accountState,
'details' => $details
] );
}
} }

View File

@ -0,0 +1,21 @@
<?php use common\components\total\TotalMediumTicketsWidget;
use common\components\total\TotalProductsByCategoryWidget;
use common\components\total\TotalDetailedMoneyMovementWidget;
?>
<p>Bérletek típus szerint</p>
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
<p>Termékek kategória szerint</p>
<?php echo TotalProductsByCategoryWidget::widget(['dailyListing' => $details]);?>
<p>Pénzmozgások</p>
<?php echo TotalDetailedMoneyMovementWidget::widget(['dailyListing' => $details]);?>
<p>Összesen </p>
<table class="table table-bordered table-striped table-summary table-total">
<tr>
<th>Végösszeg bruttó</th>
<td class="money"><span style='border-bottom: 1px solid black'><?php echo \Yii::$app->formatter->asInteger( $model->money)?> FT</span></td>
</tr>
</tbody>
</table>

View File

@ -0,0 +1,61 @@
<?php
use common\components\accountstate\AccountStateWidget;
use yii\helpers\Html;
use yii\helpers\Url;
use common\components\total\TotalDifferenceWidget;
?>
<style>
.btn-pdf{
margin-bottom: 6px;
}
td.money{
text-align: right;
}
p{
font-weight: bold;
font-size: 16px;
}
</style>
<div class="account-state-view">
<h1>Napi összefoglaló</h1>
<?php
if ( $model->hasDifferenceToPrevState() ){
if ( $model->hasMinus()){
?>
<div class="alert alert-danger" role="alert">Negatív különbözet</div>
<?php
}else{
?>
<div class="alert alert-success" role="alert">Pozitív különbözet</div>
<?php
}
}
?>
<?php echo AccountStateWidget::widget(['model' =>$model]) ?>
<?php
echo Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt'])."&nbsp;Pdf", Url::current(['output' =>'pdf']) ,['class' => 'btn btn-primary btn-pdf']);
?>
<?php if ( $model->hasDifferenceToPrevState() ){
?>
<h2>Különbözet</h2>
<?php
echo TotalDifferenceWidget::widget(['model' => $model] );
}
?>
</div>
<?php echo $this->render('_mixed', [
'model' => $model,
'details' => $details
] ); ?>

View File

@ -0,0 +1,45 @@
<?php
use common\components\accountstate\AccountStateWidget;
use common\components\total\TotalDifferenceWidget;
?>
<div class="account-state-view ">
<table class="table-top">
<tbody>
<tr>
<td class="top-cell first">
<p class="p">Zárás összefoglaló</p>
<?php echo AccountStateWidget::widget(['model' =>$model]) ?>
</td>
<td class="top-cell last">
<?php if ( $model->hasDifferenceToPrevState() ){
?>
<?php
if ( $model->hasMinus()){
?>
<p class="p">Negatív különbözet</p>
<?php
}else{
?>
<p class="p">Pozitív különbözet</p>
<?php
}
echo TotalDifferenceWidget::widget(['model' => $model] );
}
?>
</td>
</tr>
</tbody>
</table>
</div>
<?php echo $this->render('_mixed', [
'model' => $model,
'details' => $details
] ); ?>

View File

@ -15,6 +15,7 @@ use yii\base\Widget;
use common\models\AccountState; use common\models\AccountState;
use yii\helpers\Url; use yii\helpers\Url;
use common\components\accountstate\AccountStateWidget; use common\components\accountstate\AccountStateWidget;
use common\components\total\TotalProductsByCategoryWidget;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $model common\models\AccountState */ /* @var $model common\models\AccountState */
@ -81,6 +82,8 @@ $this->params['breadcrumbs'][] = $this->title;
role="tab" data-toggle="tab">Részletes összesítő</a></li> role="tab" data-toggle="tab">Részletes összesítő</a></li>
<li role="presentation" class=""><a href="#banknotes" <li role="presentation" class=""><a href="#banknotes"
aria-controls="banknotes" role="tab" data-toggle="tab">Címletek</a></li> aria-controls="banknotes" role="tab" data-toggle="tab">Címletek</a></li>
<li role="presentation" class=""><a href="#printing"
aria-controls="printing" role="tab" data-toggle="tab">Nyomtatni</a></li>
</ul> </ul>
<!-- Tab panes --> <!-- Tab panes -->
@ -107,6 +110,12 @@ $this->params['breadcrumbs'][] = $this->title;
<h2>Címletek</h2> <h2>Címletek</h2>
<?php echo BankNotesWidget::widget(['model' => $model]);?> <?php echo BankNotesWidget::widget(['model' => $model]);?>
</div> </div>
<div role="tabpanel" class="tab-pane " id="printing">
<h2>Részletek</h2>
<?php echo TotalMediumTicketsWidget::widget(['dailyListing' => $details]);?>
<?php echo TotalProductsByCategoryWidget::widget(['dailyListing' => $details]);?>
<?php echo TotalDetailedMoneyMovementWidget::widget(['dailyListing' => $details]);?>
</div>
</div> </div>
</div> </div>

View File

@ -32,7 +32,6 @@ use common\components\Azaz;
$img = "<img height='20px' src='" . \Yii::getAlias("@webroot") . DIRECTORY_SEPARATOR. "images" . DIRECTORY_SEPARATOR . "alairas.jpg'>"; $img = "<img height='20px' src='" . \Yii::getAlias("@webroot") . DIRECTORY_SEPARATOR. "images" . DIRECTORY_SEPARATOR . "alairas.jpg'>";
?> ?>
<h1 style='text-align: center'> <h1 style='text-align: center'>

View File

@ -0,0 +1,69 @@
h1{
font-size: 16px;
}
.table td,
.table th{
font-size: 10px;
}
.btn-pdf{
margin-bottom: 6px;
}
td.money{
text-align: right;
}
p{
font-weight: bold;
font-size: 12px;
}
.total-medium-ticket td.name,
.total-product-by-category td.name
{
width: 50%;
}
.total-medium-ticket td.count,
.total-product-by-category td.count
{
width: 25%;
}
.table-total td.money{
width: 50%;
}
.table-account-view td{
width: 50%;
}
.table-account-diff td{
width: 50%;
}
.table-money-movements-detailed td.created-at{ width: 120px;}
.table-money-movements-detailed td.account{ width: 80px;}
.table-money-movements-detailed td.username{ width: 80px;}
.table-money-movements-detailed td.name{ width: 80px;}
.table-money-movements-detailed td.type{ width: 80px;}
.table-money-movements-detailed td.money{ width: 70px;}
table.table-top {
width: 100%;
}
table.table-top td.top-cell {
width: 48%;
vertical-align: top;
}
table.table-top td.top-cell .table {
margin-top: 6px;
}
table.table-top td.first {
padding-right: 3px;
}
table.table-top td.last {
padding-left: 3px;
}