add reception account transfer/mixed

This commit is contained in:
2016-03-04 21:46:31 +01:00
parent da96c64348
commit ead52ae09b
18 changed files with 357 additions and 17 deletions

View File

@@ -59,6 +59,11 @@ class AccountStateBanknoteCountWidget extends Widget{
$s .= Html::a( Html::tag("span","",['class' =>'glyphicon glyphicon-download-alt']) ." 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('<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]), [
'title' => 'Részletek',
'class' => 'btn btn-success',

View File

@@ -27,7 +27,8 @@ class AccountStateController extends Controller {
'index',
'open',
'close',
'view'
'view' ,
'mixed'
],
'rules' => [
// 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 yii\helpers\Url;
use common\components\accountstate\AccountStateWidget;
use common\components\total\TotalProductsByCategoryWidget;
/* @var $this yii\web\View */
/* @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>
<li role="presentation" class=""><a href="#banknotes"
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>
<!-- Tab panes -->
@@ -107,6 +110,12 @@ $this->params['breadcrumbs'][] = $this->title;
<h2>Címletek</h2>
<?php echo BankNotesWidget::widget(['model' => $model]);?>
</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>

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'>";
?>
<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;
}