add editable giro pay date
This commit is contained in:
parent
bd5406f8be
commit
2647ca6aa6
@ -112,7 +112,7 @@ class TicketInstallmentRequestController extends Controller
|
|||||||
{
|
{
|
||||||
$model = new GiroKotegForm();
|
$model = new GiroKotegForm();
|
||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) ) {
|
if ($model->load(Yii::$app->request->post()) && $model->validate() ) {
|
||||||
$model->createKoteg();
|
$model->createKoteg();
|
||||||
return $this->redirect(['ugiro/view', 'id' => $model->koteg->id_ugiro]);
|
return $this->redirect(['ugiro/view', 'id' => $model->koteg->id_ugiro]);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,13 +31,45 @@ class GiroKotegForm extends Model{
|
|||||||
public $koteg;
|
public $koteg;
|
||||||
public $success;
|
public $success;
|
||||||
|
|
||||||
|
public $timestamp_teljesites_datum;
|
||||||
|
public $teljesitesi_datum;
|
||||||
|
|
||||||
public function rules(){
|
public function rules(){
|
||||||
return [
|
return [
|
||||||
[['action'], 'safe']
|
[['action'], 'safe'] ,
|
||||||
|
[[ 'teljesitesi_datum', ], 'required'],
|
||||||
|
[[ 'teljesitesi_datum', ], 'date', 'format' =>Yii::$app->formatter->dateFormat , 'timestampAttribute' => 'timestamp_teljesites_datum' ,'timestampAttributeFormat' => 'yyyy-MM-dd' ,'timeZone' => 'UTC' ],
|
||||||
|
|
||||||
|
['teljesitesi_datum', "validateRequestCount"],
|
||||||
|
['teljesitesi_datum', "validateMaxPlusDay"],
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function validateRequestCount($a,$p){
|
||||||
|
$this->readRequests();
|
||||||
|
if ( count( $this->requests ) == 0 ){
|
||||||
|
$this->addError("teljesitesi_datum", "Megbízások száma 0!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A teljesítési dátum max 8 nappal lehet a létrehozás dátumán túl
|
||||||
|
* */
|
||||||
|
public function validateMaxPlusDay(){
|
||||||
|
$date = new \DateTime('now');
|
||||||
|
$date->add(new \DateInterval('P8D'));
|
||||||
|
$date->setTime(0,0,0);
|
||||||
|
|
||||||
|
$td = new \DateTime();
|
||||||
|
$td->setTimestamp( strtotime( $this->timestamp_teljesites_datum ) );
|
||||||
|
$date->setTime(0,0,0);
|
||||||
|
|
||||||
|
if ( $td > $date){
|
||||||
|
$this->addError( "teljesitesi_datum", "Érvénytelen terhelési dátum. A terhelési dátum max +8 nap lehet");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function createKoteg(){
|
public function createKoteg(){
|
||||||
$this->readRequests();
|
$this->readRequests();
|
||||||
@ -98,6 +130,7 @@ class GiroKotegForm extends Model{
|
|||||||
$this->koteg->id_user = \Yii::$app->user->id;
|
$this->koteg->id_user = \Yii::$app->user->id;
|
||||||
|
|
||||||
$this->koteg->datum = date('Ymd');
|
$this->koteg->datum = date('Ymd');
|
||||||
|
$this->koteg->terhelesi_datum = $this->teljesitesi_datum;
|
||||||
|
|
||||||
$lastNumber = $this->loadLastNumber($this->koteg->datum);
|
$lastNumber = $this->loadLastNumber($this->koteg->datum);
|
||||||
$nextNumber = $lastNumber+1;
|
$nextNumber = $lastNumber+1;
|
||||||
@ -120,7 +153,8 @@ class GiroKotegForm extends Model{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function generateFileContent(){
|
public function generateFileContent(){
|
||||||
$this->content = GiroBeszed::createFileContent($this->koteg->number, $this->koteg->datum, $this->requests);
|
$terhelesi_datum =\Yii::$app->formatter->asDate($this->timestamp_teljesites_datum, 'php:Ymd');
|
||||||
|
$this->content = GiroBeszed::createFileContent($this->koteg->number, $this->koteg->datum, $this->requests,$terhelesi_datum);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveFile( ) {
|
public function saveFile( ) {
|
||||||
|
|||||||
@ -7,6 +7,8 @@ use yii\base\Widget;
|
|||||||
use kartik\widgets\ActiveForm;
|
use kartik\widgets\ActiveForm;
|
||||||
use backend\assets\PendingRequestAsset;
|
use backend\assets\PendingRequestAsset;
|
||||||
use yii\helpers\Url;
|
use yii\helpers\Url;
|
||||||
|
use kartik\widgets\DateTimePicker;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $searchModel backend\models\TicketInstallmentRequestSearch */
|
/* @var $searchModel backend\models\TicketInstallmentRequestSearch */
|
||||||
@ -23,6 +25,28 @@ PendingRequestAsset::register($this);
|
|||||||
<h1><?= Html::encode($this->title) ?></h1>
|
<h1><?= Html::encode($this->title) ?></h1>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin([
|
||||||
|
'action' => Url::current(),
|
||||||
|
'method' => 'post',
|
||||||
|
]); ?>
|
||||||
|
<?php echo $form->field($model, 'action')->hiddenInput()->label(false) ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-3">
|
||||||
|
<?= $form->field($model, 'teljesitesi_datum')->widget(DatePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton("Köteg létrehozása", ['class' => 'btn btn-primary']) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo ListView::widget([
|
echo ListView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
@ -30,15 +54,4 @@ PendingRequestAsset::register($this);
|
|||||||
]);
|
]);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php $form = ActiveForm::begin([
|
|
||||||
'action' => Url::current(),
|
|
||||||
'method' => 'post',
|
|
||||||
]); ?>
|
|
||||||
<?php echo $form->field($model, 'action')->hiddenInput()->label(false) ?>
|
|
||||||
<div class="form-group">
|
|
||||||
<?= Html::submitButton("Köteg létrehozása", ['class' => 'btn btn-primary']) ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -52,6 +52,11 @@ $attributes = [
|
|||||||
'attribute' => 'created_at',
|
'attribute' => 'created_at',
|
||||||
'label' => 'Létrehozva',
|
'label' => 'Létrehozva',
|
||||||
'format' =>'datetime'
|
'format' =>'datetime'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'terhelesi_datum',
|
||||||
|
'label' => 'Terhelési dátum',
|
||||||
|
'format' =>'datetime'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'path',
|
'attribute' => 'path',
|
||||||
|
|||||||
3
backend/web/info.php
Normal file
3
backend/web/info.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
phpinfo();
|
||||||
|
?>
|
||||||
@ -24,6 +24,7 @@ class GiroBeszed extends GiroBase {
|
|||||||
if ( !isset($terhelesiDatum)){
|
if ( !isset($terhelesiDatum)){
|
||||||
$terhelesiDatum = date('Ymd' ,strtotime("+5 day"));
|
$terhelesiDatum = date('Ymd' ,strtotime("+5 day"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$s = self::createFej($number, $datum);
|
$s = self::createFej($number, $datum);
|
||||||
$s .= self::createTetelek($requests,$terhelesiDatum);
|
$s .= self::createTetelek($requests,$terhelesiDatum);
|
||||||
$s .= self::createLab($requests);
|
$s .= self::createLab($requests);
|
||||||
|
|||||||
@ -17,6 +17,7 @@ use yii\helpers\ArrayHelper;
|
|||||||
* @property integer $number
|
* @property integer $number
|
||||||
* @property string $created_at
|
* @property string $created_at
|
||||||
* @property string $updated_at
|
* @property string $updated_at
|
||||||
|
* @property string $terhelesi_datum
|
||||||
*/
|
*/
|
||||||
class Ugiro extends \yii\db\ActiveRecord
|
class Ugiro extends \yii\db\ActiveRecord
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160331_184302_add_ugiro_terhelesi_datum extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("ugiro", "terhelesi_datum", "datetime");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m160331_184302_add_ugiro_terhelesi_datum cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user