Finish version/v.0.0.49

This commit is contained in:
Roland Schneider 2016-03-04 21:59:18 +01:00
commit a3bec37b7f
30 changed files with 582 additions and 33 deletions

View File

@ -59,6 +59,7 @@ class ContractSearch extends Contract
'contract.part_count as contract_part_count',
'contract.created_at as contract_created_at',
'contract.expired_at as contract_expired_at',
'contract.started_at as contract_started_at',
]);
$query->from('contract');
@ -117,6 +118,10 @@ class ContractSearch extends Contract
'asc' => ['contract.expired_at' => SORT_ASC ],
'desc' => ['contract.expired_at' => SORT_DESC],
],
'contract_started_at' => [
'asc' => ['contract.started_at' => SORT_ASC ],
'desc' => ['contract.started_at' => SORT_DESC],
],
]
],
]);

View File

@ -75,6 +75,11 @@ $this->params['breadcrumbs'][] = $this->title;
'label' =>'Létrehozva',
'format' => 'date'
],
[
'attribute' => 'contract_started_at' ,
'label' =>'Érvényes tól',
'format' => 'date'
],
[
'attribute' => 'contract_expired_at' ,
'label' =>'Lejárat',

View File

@ -1,3 +1,6 @@
-0.0.49
- contract - add started_at
- receptions/account-state/mixed
-0.0.48
- add payment method 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;
}
/**
* 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(){
$this->readTicketMoney();
$this->readProductsMoney();

View File

@ -254,6 +254,13 @@ class Helper {
public static function fixAsciiChars($in) {
$out = str_replace ( "ö", "0", $in );
$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;
}
public static function isUserCartVisibilityUser() {
@ -361,7 +368,7 @@ class Helper {
return $result;
}
public static function generateRandomString($length = 6,$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' ) {
public static function generateRandomString($length = 6,$characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWX' ) {
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {

View File

@ -40,7 +40,8 @@ class AccountStateWidget extends Widget{
'user.username',
[
'attribute' => 'created_at',
'label' => 'Nyitás ideje'
'label' => 'Nyitás ideje',
'format' => 'datetime'
],
];
}else{
@ -61,11 +62,13 @@ class AccountStateWidget extends Widget{
'user.username',
[
'attribute' => 'start_date',
'label' => 'Előző nyitás ideje'
'label' => 'Előző nyitás ideje' ,
'format' => 'datetime'
],
[
'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([
'options' => ['class' => 'table table-striped table-bordered detail-view table-account-view'] ,
'model' => $this->model,
'attributes' =>$attributes,
]) ;

View File

@ -27,6 +27,7 @@ class TotalDifferenceWidget extends Widget{
$ft = " Ft";
$s .= DetailView::widget([
'options' => ['class' => 'table table-striped table-bordered detail-view table-account-diff'],
'model' => $this->model,
'template' =>"<tr><th>{label}</th><td style='text-align: right;'>{value} </td></tr>",
'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',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.48',
'version' => 'v0.0.49',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@ -22,6 +22,7 @@ use common\components\Helper;
* @property string $expired_at
* @property string $created_at
* @property string $updated_at
* @property string $started_at
*/
class Contract extends \yii\db\ActiveRecord
{
@ -82,6 +83,7 @@ class Contract extends \yii\db\ActiveRecord
'expired_at' => Yii::t('common/contract', 'Lejárati dátum'),
'created_at' => Yii::t('common/contract', 'Létrehozva'),
'updated_at' => Yii::t('common/contract', 'Módosítva'),
'started_at' => Yii::t('common/contract', 'Érvényesség kezdete'),
];
}

View File

@ -123,7 +123,12 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
}
public function getTicketExpirationDate(){
return strtotime( $this->request_target_time_at . " +1 month -1 day") ;
$date = \DateTime::createFromFormat("Y-m-d H:i:s", $this->request_target_time_at, new \DateTimeZone( 'UTC'));
$date->modify("+1 month");
$date->modify("-1 day");
$date->setTime(0, 0, 0);
return $date->getTimestamp();
}
@ -244,11 +249,13 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
$discount = $ticket->discount;
$money = $type->installment_money;
if ( isset( $discount ) ){
$money = Discount::applyDiscount($money, $discount);
$money = Discount::applyDiscount( $money, $discount );
}
$ticketCreatedAt = time();
for ( $i = 1; $i <= $count; $i++){
$request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $contract, $money, $ticketCreatedAt, $i);
$request = TicketInstallmentRequest::createInstallment($ticket, $type, $customer, $contract, $money, null, $i);
$result[] = $request;
}
@ -262,7 +269,11 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
$request->id_customer = $customer->id_customer;
$request->status = TicketInstallmentRequest::$STATUS_PENDING;
$request->priority = $index;
$request->request_target_time_at = date('Y-m-d H:i:s', strtotime("+".$index." month" ));
$date = \DateTime::createFromFormat("Y.m.d", $contract->started_at, new \DateTimeZone( 'UTC'));
$date->modify("+$index month");
// $date->modify("-1 day");
$date->setTime(0, 0, 0);
$request->request_target_time_at = $date->format ( 'Y-m-d H:i:s' );
$request->request_processed_at = null;
$request->request_sent_at = null;
$request->money = $money;

View File

@ -672,8 +672,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
self::notInInterval ( $query, 'transfer.created_at', $start, $end );
}
echo "start date is: ". $start;
echo "start date is: " . gettype( $start );
// echo "start date is: ". $start;
// echo "start date is: " . gettype( $start );
if ( !RoleDefinition::isAdmin() ){
Helper::restrictIfNotAdminTheStartDate($query, $start);

View File

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

@ -0,0 +1,31 @@
<?php
use yii\db\Schema;
use yii\db\Migration;
class m160302_171507_alter__table__contract__add__column__started_at extends Migration
{
public function up()
{
$this->addColumn("contract", "started_at", "datetime");
$this->execute("update contract set started_at = created_at");
}
public function down()
{
echo "m160302_171507_alter__table__contract__add__column__started_at cannot be reverted.\n";
return false;
}
/*
// Use safeUp/safeDown to run migration code within a transaction
public function safeUp()
{
}
public function safeDown()
{
}
*/
}

View File

@ -0,0 +1,29 @@
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace frontend\assets;
use yii\web\AssetBundle;
/**
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/
class ContractMakeAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
];
public $js = [
'js/contract.make.js',
];
public $depends = [
'frontend\assets\AppAsset',
'yii\jui\JuiAsset',
];
}

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;']);
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]), [
'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

@ -284,9 +284,14 @@ class ContractController extends Controller {
throw new Exception ( "Az oldal nem található" );
}
$model = new ContractForm ( [
'customer' => $customer
] );
$model->started_at = date(date('Y.m.d'));
$model->fillOut ();
if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) {

View File

@ -39,6 +39,8 @@ class ContractForm extends Model {
private $ticketType;
private $money;
private $discount;
public $started_at;
public $timestampStart;
/**
* @inheritdoc
*/
@ -59,7 +61,9 @@ class ContractForm extends Model {
"bank_name",
'phone',
'email',
'payment_method'
'payment_method' ,
'started_at',
'started_at'
],
'required'
],
@ -124,7 +128,8 @@ class ContractForm extends Model {
'ticket_type'
],
'validateTicketType'
]
] ,
[[ 'started_at', ], 'date', 'format' =>Yii::$app->formatter->dateFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ,'timeZone' => 'UTC' ],
];
}
public function validateTicketType($attribute, $params) {
@ -162,6 +167,7 @@ class ContractForm extends Model {
'ticket_type' => 'Bérlet típus' ,
'payment_method' => 'Fizetési mód (első bérlet)' ,
'id_discount' => 'Kedvezmény' ,
'started_at' => 'Érvényesség kezdete' ,
];
}
public function fillOut() {
@ -223,8 +229,8 @@ class ContractForm extends Model {
$ticket->id_user = \Yii::$app->user->id;
$ticket->id_account = Account::readDefault ();
$ticket->id_discount = $this->id_discount;
$ticket->start = date ( 'Y-m-d' );
$date = new \DateTime ();
$ticket->start = $this->started_at;
$date = new \DateTime ( $this->timestampStart);
$date->modify ( '+1 month' );
$date->modify ( '-1 day' );
$ticket->end = $date->format ( 'Y-m-d H:i:s' );
@ -283,7 +289,12 @@ class ContractForm extends Model {
$contract->part_count = $this->ticketType->installment_count;
$contract->part_paid = 0;
$contract->part_required = 0;
$contract->expired_at = date ( 'Y-m-d', strtotime ( "today +12 month -1 day" ) );
$contract->started_at = $this->started_at;
$date = new \DateTime( $this->timestampStart );
$date->modify ( '+1 year' );
$date->modify ( '-1 day' );
$date->setTime(0, 0, 0);
$contract->expired_at = $date->format ( 'Y-m-d H:i:s' );
$contract->id_ticket_type = $this->ticketType->id_ticket_type;
if (! $contract->save ( false )) {

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

@ -14,6 +14,11 @@ use common\components\Azaz;
$customerBankAccount = $customer->bank_account;
$customerIdCustomer = $customer->id_customer;
// $dt = \DateTime::createFromFormat("Y-m-d H:i:s", $model->started_at);
// $contractStartAtDate = $dt->format("Y.m.d");
$contractStartAtDate = \Yii::$app->formatter->asDate($model->started_at);
$contractDate = date('Y.m.d');
$azaz = new Azaz();
@ -27,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'>
@ -241,7 +245,7 @@ másrészről:
Teljesítés adatai:
</div>
<div>
Érvényesség kezdete: <?php echo $contractDate?> lejárata:
Érvényesség kezdete: <?php echo $contractStartAtDate?> lejárata:
</div>
<div>
Teljesítés felső értékhatára:

View File

@ -8,6 +8,7 @@ use frontend\components\HtmlHelper;
use kartik\widgets\DatePicker;
use common\models\Transfer;
use common\models\Discount;
use frontend\assets\ContractMakeAsset;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
@ -17,12 +18,26 @@ use common\models\Discount;
<?php
ContractMakeAsset::register($this);
$types = TicketType::findAll(['status' => TicketType::STATUS_ACTIVE ,'installment_enabled' => '1']);
$typeOptions = TicketType::modelsToArray($types);
$types = HtmlHelper::mkTicketTypeOptions($types);
$discounts = Discount::readTicketDiscounts();
$discountOptions = Discount::modelsToArray($discounts,[]);
$discounts = ['' => ''] + HtmlHelper::mkDiscountOptions($discounts);
$options = [];
$options['ticket_types'] = $typeOptions;
$options['discounts'] = $discountOptions;
$this->registerJs(' contract_make.init( '. json_encode($options) .' );');
?>
<h1>Szerződés létrehozása</h1>
<div class="contract-form">
@ -92,7 +107,12 @@ use common\models\Discount;
<?= $form->field($model, 'ticket_type')->dropDownList($types) ?>
</div>
<div class="col-md-6">
<?= $form->field($model, 'started_at')->widget(\kartik\date\DatePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd'
]
]) ?>
</div>
</div>
<div class="row">
@ -106,8 +126,19 @@ use common\models\Discount;
<p>
Figyelem: A szerződés létrehozásakor a szerződés első bérlete bekerül a vásálró kosarába.
</p>
<table class="table table-striped">
<tr>
<td>Bérlet ára</td>
<td class="ticket-price"></td>
</tr>
<tr>
<td>Összesen</td>
<td class="ticket-total"></td>
</tr>
</table>
<div class="form-group">

View File

@ -41,6 +41,7 @@ $this->params['breadcrumbs'][] = $this->title;
'part_paid',
'part_required',
'part_count',
'started_at:datetime',
'expired_at:datetime',
'created_at:datetime',
'updated_at:datetime',

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;
}

View File

@ -0,0 +1,70 @@
var contract_make ={
defaults :{
ticket_types : [],
discounts: [],
dd_types: '#contractform-ticket_type',
dd_discounts: '#contractform-id_discount',
},
init: function(o){
contract_make.defaults = $.extend(contract_make.defaults, o);
contract_make.update();
contract_make.getDDTypes().change(contract_make.update);
contract_make.getDDDiscounts().change(contract_make.update);
},
getDDTypes: function(){
return $(contract_make.defaults.dd_types);
},
getDDDiscounts: function(){
return $(contract_make.defaults.dd_discounts);
},
findType: function(id){
var type ;
var i;
type = null;
for ( i = 0; i<contract_make.defaults.ticket_types.length; i++ ){
if ( contract_make.defaults.ticket_types[i]['id_ticket_type'] == id ){
type = contract_make.defaults.ticket_types[i];
break;
}
}
return type;
},
findDiscount: function(id){
var type ;
var i;
type = null;
if ( id && !isNaN(id) ){
for ( i = 0; i < contract_make.defaults.discounts.length; i++ ){
if ( contract_make.defaults.discounts[i]['id_discount'] == id ){
type = contract_make.defaults.discounts[i];
break;
}
}
}
return type;
},
update: function(){
var type = contract_make.findType( +contract_make.getDDTypes().val());
var discount = contract_make.findDiscount( +contract_make.getDDDiscounts().val() );
var total = contract_make.calcPriceBrutto(type,discount);
$('.ticket-price').html(type.price_brutto);
$('.ticket-total').html(total);
},
calcPriceBrutto: function(type,discount){
var result;
result = type.price_brutto;
if ( discount!= null ){
var d = result* discount.value /100;
d = Math.floor( d );
result = result - d;
}
return result;
}
}