detsta processing -> move to cart if not successfull, transfer/paymentLater changes

This commit is contained in:
Roland Schneider 2016-07-27 07:20:47 +02:00
parent b52cc1a438
commit fdbd39b059
29 changed files with 700 additions and 124 deletions

View File

@ -108,7 +108,7 @@ class AdminMenuStructure{
// $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ]; // $items[] = ['label' => 'Bevétel', 'url' => ['/transfer/summary' , 'TransferSummarySearch[start]' =>$today,'TransferSummarySearch[end]' => $tomorrow ] ];
$items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ]; $items[] = ['label' => 'Napi bevételek', 'url' => ['/transfer/list', 'TransferListSearch[start]' =>$todayDatetime,'TransferListSearch[end]' => $tomorrowDatetime ] ];
$items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ]; $items[] = ['label' => 'Kassza müveletek', 'url' => ['/account-state/index'] ];
$items[] = ['label' => 'Későbbi utalások', 'url' => ['/transfer/payment-later','TransferLaterSearch[start]' =>$todayDatetime,'TransferLaterSearch[end]' => $tomorrowDatetime ] ]; $items[] = ['label' => 'Későbbi utalások', 'url' => ['/transfer/payment-later','TransferLaterSearch[start]' =>$todayDatetime,'TransferLaterSearch[end]' => $tomorrowDatetime ,'TransferLaterSearch[enterStart]' =>$todayDatetime,'TransferLaterSearch[enterEnd]' => $tomorrowDatetime ] ];
//$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ]; //$items[] = ['label' => 'Zárások', 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$todayDatetime,'CollectionSearch[end]' => $tomorrowDatetime ] ];
$this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl, $this->menuItems[] = ['label' => 'Pénzügy', 'url' => $this->emptyUrl,
'items' => $items 'items' => $items

View File

@ -1,9 +1,12 @@
<?php <?php
namespace backend\controllers; namespace backend\controllers;
use common\models\DoorLog;
use Yii; use Yii;
use common\models\Transfer; use common\models\Transfer;
use backend\models\TransferSearch; use backend\models\TransferSearch;
use yii\db\Expression;
use yii\db\Query;
use yii\web\Controller; use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
@ -81,7 +84,9 @@ class TransferController extends \backend\controllers\BackendController
if ( $searchModel->output =='pdf'){ if ( $searchModel->output =='pdf'){
$this->downloadPaymentLater($dataProvider); $this->downloadPaymentLaterPDF($dataProvider);
}else if ( $searchModel->output =='xls'){
$this->downloadPaymentLaterXLS($searchModel, $dataProvider);
} }
$accounts = Account::read(); $accounts = Account::read();
@ -97,7 +102,151 @@ class TransferController extends \backend\controllers\BackendController
]); ]);
} }
protected function downloadPaymentLater($dataProvider) {
protected function getEnterCount($start,$end,$idCustomer){
$query = new Query();
$query->select([
'card.number as card_number',
'card.id_card as card_id_card',
'count(*) as enter',
new Expression('EXTRACT( YEAR_MONTH FROM door_log.created_at) as ym'),
new Expression('EXTRACT( YEAR FROM door_log.created_at ) as year'),
new Expression('EXTRACT( MONTH FROM door_log.created_at ) as month ')
]);
$query->from('door_log');
$query->innerJoin('card','card.id_card = door_log.id_card');
$query->andWhere(['in','door_log.direction',[3,7]]);
$query->groupBy([
'card.number',
'card.id_card',
'ym',
'year',
'month'
]);
$query->andWhere(['door_log.id_customer' => $idCustomer]);
$query->andWhere([ '>=','door_log.created_at',$start]);
$query->andWhere([ '<','door_log.created_at',$end]);
$customerStatistic = $query->one();
$moveInCount = $customerStatistic['enter'];
return $moveInCount;
}
/**
* @param \backend\models\TransferLaterSearch $searchModel
* @param \yii\data\ActiveDataProvider $dataProvider
*/
protected function downloadPaymentLaterXLS( $searchModel, $dataProvider) {
$fn = "kesobbi_utalasok.xls";
$objPHPExcel = new \PHPExcel ();
$sheet = $objPHPExcel->setActiveSheetIndex ( 0 );
$formatter = \Yii::$app->formatter;
$row = 1;
$sheet->setCellValue('A'.$row, 'Csoportos beszedés');
$row++;
$sheet->setCellValue('A'.$row, 'Időszak kezdete');
$sheet->setCellValue('B'.$row, $searchModel->start);
$sheet->setCellValue('C'.$row, 'Időszak vége');
$sheet->setCellValue('D'.$row, $searchModel->end);
$row++;
$sheet->setCellValue('A'.$row, 'Belépési Időszak kezdete');
$sheet->setCellValue('B'.$row, $searchModel->enterStart);
$sheet->setCellValue('C'.$row, 'Belépési Időszak vége');
$sheet->setCellValue('D'.$row, $searchModel->enterEnd);
$row++;
$sheet->setCellValue('A'.$row, 'Bérlettípus');
$sheet->setCellValue('B'.$row, $searchModel->id_ticket_type);
$sheet->setCellValue('C'.$row, 'Felhasználó');
$sheet->setCellValue('D'.$row, $searchModel->id_user);
$row++;
$sheet->setCellValue('A'.$row, 'Kártyaszám')
->setCellValue('B'.$row, 'Vendég')
->setCellValue('C'.$row, 'Kiadva')
->setCellValue('D'.$row, 'Bérlet típus')
->setCellValue('E'.$row, 'Összeg')
->setCellValue('F'.$row, 'Megjegyzés')
->setCellValue('G'.$row, 'Belépések az időszakban');
;
foreach ( $dataProvider->getModels() as $model ) {
$row ++;
$sheet
->setCellValue('A'.$row, $model['card_number'])
->setCellValue('B'.$row, $model['customer_name'])
->setCellValue('C'.$row, $model['transfer_created_at'])
->setCellValue('D'.$row, ($model['ticket_type_name']))
->setCellValue('E'.$row, $model['transfer_money'])
->setCellValue('F'.$row, $model['ticket_comment'])
->setCellValue('G'.$row, $model['enter'])
// ->setCellValue('F'.$row, $processedTime)
// ->setCellValue('G'.$row, $status)
;
}
$styleArray = array (
'font' => array (
'bold' => true
)
);
$sheet->getStyle ( 'A1' )->applyFromArray ( $styleArray );
foreach ( range ( 'A', 'G' ) as $columnID ) {
$sheet->getColumnDimension ( $columnID )->setAutoSize ( true );
$sheet->getStyle ( $columnID . '5' )->applyFromArray ( $styleArray );
}
foreach ( ['A','C'] as $columnID ) {
$sheet->getColumnDimension ( $columnID )->setAutoSize ( true );
$sheet->getStyle ( $columnID . '2' )->applyFromArray ( $styleArray );
$sheet->getStyle ( $columnID . '3' )->applyFromArray ( $styleArray );
$sheet->getStyle ( $columnID . '4' )->applyFromArray ( $styleArray );
}
$fileName = $fn;
// Redirect output to a clients web browser (Excel5)
header ( 'Content-Type: application/vnd.ms-excel' );
header ( 'Content-Disposition: attachment;filename="' . $fileName . '"' );
header ( 'Cache-Control: max-age=0' );
// If you're serving to IE 9, then the following may be needed
header ( 'Cache-Control: max-age=1' );
// If you're serving to IE over SSL, then the following may be needed
header ( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); // Date in the past
header ( 'Last-Modified: ' . gmdate ( 'D, d M Y H:i:s' ) . ' GMT' ); // always modified
header ( 'Cache-Control: cache, must-revalidate' ); // HTTP/1.1
header ( 'Pragma: public' ); // HTTP/1.0
$objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' );
$objWriter->save ( 'php://output' );
exit ();
}
protected function downloadPaymentLaterPDF($dataProvider) {
// $mpdf = new \mPDF ( 'utf-8', 'A4' ); // $mpdf = new \mPDF ( 'utf-8', 'A4' );
$mpdf = new \mPDF ( 'utf-8', 'A4-L' ); $mpdf = new \mPDF ( 'utf-8', 'A4-L' );

View File

@ -2,6 +2,7 @@
namespace backend\controllers; namespace backend\controllers;
use common\models\TicketInstallmentRequest;
use Yii; use Yii;
use common\models\Ugiro; use common\models\Ugiro;
use backend\models\UgiroSearch; use backend\models\UgiroSearch;
@ -108,7 +109,9 @@ class UgiroController extends Controller {
$output = $_GET ['output']; $output = $_GET ['output'];
if ($output == 'pdf') { if ($output == 'pdf') {
$this->downloadUgiro ( $model ); $this->downloadUgiroPdf ( $model );
}else if ($output == 'xls') {
$this->downloadUgiroXls ( $model );
} }
} }
} }
@ -128,9 +131,157 @@ class UgiroController extends Controller {
'detstaDp' => $detstaDp 'detstaDp' => $detstaDp
] ); ] );
} }
protected function downloadUgiro($model) {
// $mpdf = new \mPDF ( 'utf-8', 'A4' ); /**
* @param \common\models\Ugiro $model
*/
protected function downloadUgiroXls($model) {
$fn = "köteg.". $model->id_ugiro . ".xls";
$query = new Query();
$query->select([
'card.number as card_number',
'customer.id_customer as customer_id_customer',
'customer.name as customer_name',
'customer.bank_account as customer_bank_account',
'ticket_installment_request.money as request_money',
'ticket_installment_request.status as request_status',
'ticket_installment_request.request_target_time_at as request_request_target_time_at',
'ticket_installment_request.request_processed_at as request_request_processed_at',
]);
$query->from('ticket_installment_request');
$query->innerJoin('ugiro_request_assignment','ticket_installment_request.id_ticket_installment_request = ugiro_request_assignment.id_request');
$query->innerJoin('customer','customer.id_customer = ticket_installment_request.id_customer');
$query->innerJoin('card','customer.id_customer_card = card.id_card');
$query->andWhere(['ugiro_request_assignment.id_ugiro' => $model->id_ugiro]);
$query->orderBy(['customer.name' => SORT_ASC]);
$dataProvider = new ActiveDataProvider(
[
'query' => $query,
'sort' => false,
'pagination' => false
]
);
$objPHPExcel = new \PHPExcel ();
$sheet = $objPHPExcel->setActiveSheetIndex ( 0 );
$formatter = \Yii::$app->formatter;
$row = 1;
$sheet->setCellValue('A'.$row, 'Csoportos beszedés');
$row++;
$sheet->setCellValue('A'.$row, 'Köteg azonosító');
$sheet->setCellValue('B'.$row, $model->id_ugiro);
$sheet->setCellValue('C'.$row, 'Üzenetsorszám');
$sheet->setCellValue('D'.$row, $model->number);
$row++;
$sheet->setCellValue('A'.$row, 'Összeállítási dáutm');
$sheet->setCellValue('B'.$row, $model->datum);
$sheet->setCellValue('C'.$row, 'Terhelési dáutm');
$sheet->setCellValue('D'.$row, $model->terhelesi_datum);
$row++;
$sheet->setCellValue('A'.$row, 'Kártyaszám')
->setCellValue('B'.$row, 'Vendég')
->setCellValue('C'.$row, 'Bankszámlaszám')
->setCellValue('D'.$row, 'Összeg')
->setCellValue('E'.$row, 'Esedékességi dátum')
->setCellValue('F'.$row, 'Feldolgozás dátum')
->setCellValue('G'.$row, 'Státusz')
;
foreach ( $dataProvider->getModels() as $model ) {
$row ++;
$status = "";
switch ($model['request_status']){
case TicketInstallmentRequest::$STATUS_ACCEPTED:
$status = "Fizetve";
break;
case TicketInstallmentRequest::$STATUS_REJECTED:
$status = "Kosár";
break;
case TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL:
$status = "Kosár";
break;
case TicketInstallmentRequest::$STATUS_CANCELED:
$status = "Sztornó";
break;
case TicketInstallmentRequest::$STATUS_MARKED_TO_SEND:
$status = "Küldésre jelölve";
break;
case TicketInstallmentRequest::$STATUS_PENDING:
$status = "Feldolgozás alatt";
break;
case TicketInstallmentRequest::$STATUS_SENT:
$status = "Elküldve";
break;
default:
$status = "";
}
$targetTime = isset( $model['request_request_target_time_at'] ) ? $formatter->asDate($model['request_request_target_time_at']) :"";
$processedTime = isset( $model['request_request_processed_at'] ) ? $formatter->asDatetime($model['request_request_processed_at']) :"";
$sheet
->setCellValue('A'.$row, $model['card_number'])
->setCellValue('B'.$row, $model['customer_name'])
->setCellValue('C'.$row, $model['customer_bank_account'])
->setCellValue('D'.$row, ($model['request_money']))
->setCellValue('E'.$row, $targetTime)
->setCellValue('F'.$row, $processedTime)
->setCellValue('G'.$row, $status)
;
}
$styleArray = array (
'font' => array (
'bold' => true
)
);
$sheet->getStyle ( 'A1' )->applyFromArray ( $styleArray );
foreach ( range ( 'A', 'G' ) as $columnID ) {
$sheet->getColumnDimension ( $columnID )->setAutoSize ( true );
$sheet->getStyle ( $columnID . '4' )->applyFromArray ( $styleArray );
}
foreach ( ['A','C'] as $columnID ) {
$sheet->getColumnDimension ( $columnID )->setAutoSize ( true );
$sheet->getStyle ( $columnID . '2' )->applyFromArray ( $styleArray );
$sheet->getStyle ( $columnID . '3' )->applyFromArray ( $styleArray );
}
$fileName = $fn;
// Redirect output to a clients web browser (Excel5)
header ( 'Content-Type: application/vnd.ms-excel' );
header ( 'Content-Disposition: attachment;filename="' . $fileName . '"' );
header ( 'Cache-Control: max-age=0' );
// If you're serving to IE 9, then the following may be needed
header ( 'Cache-Control: max-age=1' );
// If you're serving to IE over SSL, then the following may be needed
header ( 'Expires: Mon, 26 Jul 1997 05:00:00 GMT' ); // Date in the past
header ( 'Last-Modified: ' . gmdate ( 'D, d M Y H:i:s' ) . ' GMT' ); // always modified
header ( 'Cache-Control: cache, must-revalidate' ); // HTTP/1.1
header ( 'Pragma: public' ); // HTTP/1.0
$objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' );
$objWriter->save ( 'php://output' );
exit ();
}
protected function downloadUgiroPdf($model) {
$mpdf = new \mPDF ( 'utf-8', 'A4-L' ); $mpdf = new \mPDF ( 'utf-8', 'A4-L' );
$fn = "köteg.". $model->id_ugiro . ".pdf"; $fn = "köteg.". $model->id_ugiro . ".pdf";

View File

@ -94,9 +94,11 @@ class TicketInstallmentRequestSearch extends TicketInstallmentRequest
'ticket.end as ticket_end',//ticket_send 'ticket.end as ticket_end',//ticket_send
'ticket.id_ticket as ticket_id_ticket',//id_ticket 'ticket.id_ticket as ticket_id_ticket',//id_ticket
'ugiro_request_assignment.id_ugiro as ugiro_id_ugiro' ,//köteg azonosító 'ugiro_request_assignment.id_ugiro as ugiro_id_ugiro' ,//köteg azonosító
'card.number as card_number'
]); ]);
$query->from("ticket_installment_request"); $query->from("ticket_installment_request");
$query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer"); $query->innerJoin("customer","customer.id_customer = ticket_installment_request.id_customer");
$query->leftJoin("card","card.id_card = customer.id_customer_card");
$query->leftJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket"); $query->leftJoin("ticket","ticket.id_ticket = ticket_installment_request.id_ticket");
$query->leftJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type"); $query->leftJoin("ticket_type","ticket.id_ticket_type = ticket_type.id_ticket_type");
$query->leftJoin("ugiro_request_assignment","ticket_installment_request.id_ticket_installment_request = ugiro_request_assignment.id_request"); $query->leftJoin("ugiro_request_assignment","ticket_installment_request.id_ticket_installment_request = ugiro_request_assignment.id_request");

View File

@ -10,9 +10,7 @@ use yii\db\Expression;
use yii\base\Object; use yii\base\Object;
use yii\db\Query; use yii\db\Query;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use common\models\Account;
use common\components\Helper; use common\components\Helper;
use common\components\RoleDefinition;
/** /**
* TransferSearch represents the model behind the search form about `common\models\Transfer`. * TransferSearch represents the model behind the search form about `common\models\Transfer`.
@ -25,6 +23,12 @@ class TransferLaterSearch extends Transfer
public $timestampStart; public $timestampStart;
public $timestampEnd; public $timestampEnd;
public $enterStart;
public $enterEnd;
public $timestampEnterStart;
public $timestampEnterEnd;
public $id_ticket_type; public $id_ticket_type;
@ -45,6 +49,8 @@ class TransferLaterSearch extends Transfer
[[ 'id_ticket_type','id_user'], 'integer'], [[ 'id_ticket_type','id_user'], 'integer'],
[[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ], [[ 'start', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ], [[ 'end' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'enterStart', ], 'date', 'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnterStart' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
[[ 'enterEnd' , ], 'date' ,'format' =>Yii::$app->formatter->datetimeFormat , 'timestampAttribute' => 'timestampEnterEnd' ,'timestampAttributeFormat' => 'yyyy-MM-dd HH:mm' ,'timeZone' => 'UTC' ],
['selected', 'each', 'rule' => ['integer']], ['selected', 'each', 'rule' => ['integer']],
]; ];
} }
@ -58,7 +64,7 @@ class TransferLaterSearch extends Transfer
return Model::scenarios(); return Model::scenarios();
} }
/** /**1
* Creates data provider instance with search query applied * Creates data provider instance with search query applied
* *
* @param array $params * @param array $params
@ -68,6 +74,9 @@ class TransferLaterSearch extends Transfer
public function search($params) public function search($params)
{ {
$query = new Query(); $query = new Query();
$this->load($params);
$valid = $this->validate();
$query->select([ $query->select([
'transfer.id_transfer as transfer_id_transfer', 'transfer.id_transfer as transfer_id_transfer',
@ -83,26 +92,49 @@ class TransferLaterSearch extends Transfer
'ticket.start as ticket_start', 'ticket.start as ticket_start',
'ticket.end as ticket_end', 'ticket.end as ticket_end',
'ticket.comment as ticket_comment', 'ticket.comment as ticket_comment',
'card.number as card_number',
new Expression('count(door_log.id_door_log) as enter'),
]); ]);
$query->from("transfer"); $query->from("transfer");
$query->innerJoin('user', " user.id = transfer.id_user"); $query->innerJoin('user', " user.id = transfer.id_user");
$query->leftJoin('customer', " transfer.id_customer = customer.id_customer"); $query->leftJoin('customer', " transfer.id_customer = customer.id_customer");
$query->leftJoin('card', " customer.id_customer_card = card.id_card");
$query->leftJoin('ticket', " transfer.type = ".Transfer::TYPE_TICKET." and transfer.id_object = ticket.id_ticket"); $query->leftJoin('ticket', " transfer.type = ".Transfer::TYPE_TICKET." and transfer.id_object = ticket.id_ticket");
$query->leftJoin('ticket_type', " ticket.id_ticket_type = ticket_type.id_ticket_type"); $query->leftJoin('ticket_type', " ticket.id_ticket_type = ticket_type.id_ticket_type");
$query->leftJoin('sale', " transfer.type = ".Transfer::TYPE_PRODUCT." and transfer.id_object = sale.id_sale"); $query->leftJoin('sale', " transfer.type = ".Transfer::TYPE_PRODUCT." and transfer.id_object = sale.id_sale");
$query->leftJoin('product', " product.id_product = sale.id_product"); $query->leftJoin('product', " product.id_product = sale.id_product");
$query->leftJoin('door_log',
"door_log.id_customer = transfer.id_customer and door_log.direction in (3,7)
and door_log.created_at >= :start and door_log.created_at < :end ",
[':start' => $this->timestampEnterStart,
':end' => $this->timestampEnterEnd]);
$query->groupBy(
[
'transfer.id_transfer',
'transfer.created_at',
'transfer.money',
'transfer.status',
'user.username',
'customer.id_customer',
'customer.name',
'customer.description',
'ticket_type.name',
'product.name',
'ticket.start',
'ticket.end',
'ticket.comment',
'card.number'
]
);
$query->andWhere(["transfer.payment_method" => Transfer::PAYMENT_METHOD_TRANSFER_LATER ]); $query->andWhere(["transfer.payment_method" => Transfer::PAYMENT_METHOD_TRANSFER_LATER ]);
$query->andWhere(['transfer.status' => Transfer::STATUS_NOT_PAID]); $query->andWhere(['transfer.status' => Transfer::STATUS_NOT_PAID]);
$this->load($params);
$valid = $this->validate();
$dataProvider = new ActiveDataProvider([ $dataProvider = new ActiveDataProvider([
'query' => $query, 'query' => $query,
'pagination' => $this->output == 'pdf' ? false : [], 'pagination' => ( $this->output == 'pdf' || $this->output == 'xls' ) ? false : [],
'sort' => [ 'sort' => [
'defaultOrder' =>[ 'defaultOrder' =>[
'transfer_created_at' => SORT_DESC 'transfer_created_at' => SORT_DESC
@ -119,6 +151,8 @@ class TransferLaterSearch extends Transfer
['ticket_end'], ['ticket_end'],
['ticket_comment'], ['ticket_comment'],
['customer_description'], ['customer_description'],
['enter'],
['card_number']
]) ])
] ]
@ -151,6 +185,40 @@ class TransferLaterSearch extends Transfer
} }
/**
* TODO: DASAP
* @param $start
* @param $end
* @param $idCustomer
*/
protected function getEnterCount($start,$end,$idCustomer){
$query = new Query();
$query->select([
'card.number as card_number',
'card.id_card as card_id_card',
'count(*) as enter',
new Expression('EXTRACT( YEAR_MONTH FROM door_log.created_at) as ym'),
new Expression('EXTRACT( YEAR FROM door_log.created_at ) as year'),
new Expression('EXTRACT( MONTH FROM door_log.created_at ) as month ')
]);
$query->from('door_log');
$query->innerJoin('card','card.id_card = door_log.id_card');
$query->andWhere(['in','door_log.direction',[3,7]]);
$query->groupBy([
'card.number',
'card.id_card',
'ym',
'year',
'month'
]);
$query->andWhere(['door_log.id_customer' => $idCustomer]);
$query->andWhere([ '>=','door_log.created_at',$start]);
$query->andWhere([ '<','door_log.created_at',$end]);
$query->all();
}
public function totalsTransfers( ){ public function totalsTransfers( ){

View File

@ -159,6 +159,10 @@ echo Html::a("Vissza a köteghez",['ugiro/view', 'id' => $model->id_ugiro] ,[ '
'value' => $tetel->request->customer->name , 'value' => $tetel->request->customer->name ,
'label' => 'Vendég' 'label' => 'Vendég'
], ],
[
'value' => $tetel->request->customer->card->number ,
'label' => 'Vendég'
],
] ]
]); ]);

View File

@ -89,7 +89,6 @@ use yii\helpers\Html;
<td> <td>
<?php echo $model['request_id_contract'] ;?> <?php echo $model['request_id_contract'] ;?>
</td> </td>
</tr> </tr>
<tr> <tr>
<th> <th>
@ -105,8 +104,10 @@ use yii\helpers\Html;
<?php echo $model['customer_name'];?> <?php echo $model['customer_name'];?>
</td> </td>
<th> <th>
Kártyaszám
</th> </th>
<td> <td>
<?php echo $model['card_number'];?>
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -46,6 +46,25 @@ use common\models\User;
]) ?> ]) ?>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'enterStart')->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
])->label("Belépések -tól") ?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'enterEnd') ->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
])->label("Belépések -ig") ?>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-4">
<?= $form->field($model, 'id_ticket_type')->dropDownList($ticketTypeOptions)->label("Bérlet típus") ?> <?= $form->field($model, 'id_ticket_type')->dropDownList($ticketTypeOptions)->label("Bérlet típus") ?>

View File

@ -38,7 +38,7 @@ $this->params['breadcrumbs'][] = $this->title;
<div style="margin-bottom: 6px;"> <div style="margin-bottom: 6px;">
<?php <?php
echo Html::a("PDF",Url::current(['TransferLaterSearch[output]'=>'pdf']), ['class' => 'btn btn-primary' ]); echo Html::a("XLS",Url::current(['TransferLaterSearch[output]'=>'xls']), ['class' => 'btn btn-primary' ]);
?> ?>
</div> </div>
@ -85,6 +85,10 @@ echo Html::a("Egyiket sem",null, ['class' => 'btn btn-primary deselect-all',
'attribute' => 'customer_name', 'attribute' => 'customer_name',
'label' => 'Vendég' 'label' => 'Vendég'
], ],
[
'attribute' => 'card_number',
'label' => 'Kártyaszám'
],
[ [
'attribute' => 'ticket_type_name', 'attribute' => 'ticket_type_name',
'label' => 'Bérlet típus' 'label' => 'Bérlet típus'
@ -126,6 +130,10 @@ echo Html::a("Egyiket sem",null, ['class' => 'btn btn-primary deselect-all',
[ [
'attribute' => 'ticket_comment', 'attribute' => 'ticket_comment',
'label' => 'Megj' 'label' => 'Megj'
],
[
'attribute' => 'enter',
'label' => 'Belépések'
], ],
], ],
]); ?> ]); ?>

View File

@ -125,7 +125,7 @@ $attributes = [
//echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']); //echo Html::a("DetSta Fájl Feldoglozás",['view', 'id' => $model->id_ugiro] ,['data-method' =>'post', 'class' => 'btn btn-danger']);
} }
echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']); echo Html::a("Megbízások a kötegben",['ticket-installment-request/index', 'TicketInstallmentRequestSearch[id_ugiro]' => $model->id_ugiro] ,[ 'class' => 'btn btn-primary']);
echo Html::a("PDF", Url::current(['output' => 'pdf']) ,[ 'class' => 'btn btn-primary']); echo Html::a("Xls", Url::current(['output' => 'xls']) ,[ 'class' => 'btn btn-primary']);
$detstaMessage = $model->messageDetsta; $detstaMessage = $model->messageDetsta;
if ( isset($detstaMessage)){ if ( isset($detstaMessage)){

View File

@ -1,3 +1,6 @@
-0.0.80
- csoportos beszedés: kosár ha nem sikerült
- későbbi utalások: xls, belépések száma
-0.0.79 -0.0.79
- add frontend confirm on delete, - add frontend confirm on delete,
- add transfer changes - add transfer changes

View File

@ -52,8 +52,6 @@ class DetStaDBSave extends Object
/** /**
* *
* @param common\models\Ugiro;
* @param common\models\giro\GiroDETSTA $giroDETSTA
* */ * */
protected function saveMessageDetsta( ) { protected function saveMessageDetsta( ) {
$this->message = new MessageDetsta(); $this->message = new MessageDetsta();

View File

@ -3,20 +3,15 @@ namespace common\components;
use yii\base\Object; use yii\base\Object;
use common\models\TicketInstallmentRequest;
use common\components\giro\GiroDETSTATetel;
use common\models\Ugiro; use common\models\Ugiro;
use common\components\giro\GiroDETSTA; use common\components\giro\GiroDETSTA;
use common\components\giro\GiroDETSTAFej;
use common\components\giro\GiroDETSTALab;
use common\components\DetStaDBSave;
/** /**
* This is the model class for table "ticket". * This is the model class for table "ticket".
* *
* @property common\components\giro\GiroDETSTA $detstatUzenet * @property \common\components\giro\GiroDETSTA $detstatUzenet
* @property common\models\UGiro $koteg * @property \common\models\UGiro $koteg
* *
* */ * */
class DetStatProcessor extends Object{ class DetStatProcessor extends Object{
@ -122,12 +117,17 @@ class DetStatProcessor extends Object{
} }
/**
*
*/
public function readKoteg(){ public function readKoteg(){
$this->koteg = Ugiro::findOne($this->idKoteg ); $this->koteg = Ugiro::findOne($this->idKoteg );
if ( !isset($this->koteg) ){ if ( !isset($this->koteg) ){
$this->errors [] = "Kötege nem található! (".$this->detstatUzenet->fej." )"; /** @var DetStatProcessor $this */
$this->errors [] = "Köteg nem található! (".$this->detstatUzenet->fej ." )";
} }
} }
public function readKotegMegbizasok(){ public function readKotegMegbizasok(){
$this->megbizasok = $this->koteg->requests; $this->megbizasok = $this->koteg->requests;
} }

View File

@ -2,6 +2,7 @@
namespace common\components; namespace common\components;
use common\models\Transfer;
use yii\base\Object; use yii\base\Object;
use common\models\TicketInstallmentRequest; use common\models\TicketInstallmentRequest;
use common\components\giro\GiroDETSTATetel; use common\components\giro\GiroDETSTATetel;
@ -11,10 +12,10 @@ use common\models\Contract;
/** /**
* This is the model class for table "ticket". * This is the model class for table "ticket".
* *
* @property common\components\giro\GiroDETSTATetel $tetel * @property \common\components\giro\GiroDETSTATetel $tetel
* @property common\models\TicketInstallmentRequest $megbizas * @property \common\models\TicketInstallmentRequest $megbizas
* @property common\models\Ticket $ticket * @property \common\models\Ticket $ticket
* @property common\models\Contract $contract * @property \common\models\Contract $contract
* *
* *
*/ */
@ -44,7 +45,7 @@ class DetStatTetelProcessor extends Object {
* */ * */
protected $comment; protected $comment;
/** /**
* A bérlet objectkum, amit elmentettünk * A bérlet objektum, amit elmentettünk
* */ * */
protected $ticket; protected $ticket;
/** /**
@ -58,13 +59,13 @@ class DetStatTetelProcessor extends Object {
\Yii::info('Megbízás feldolgozása: megbízás azonosító=' .$this->megbizas->id_ticket_installment_request); \Yii::info('Megbízás feldolgozása: megbízás azonosító=' .$this->megbizas->id_ticket_installment_request);
if ($this->isAlreadeyAccepted ()) { if ($this->isAlreadyAccepted ()) {
\Yii::info('A megbízás feldolgozásának megszakítása. A megbízás már elfogadott: megbízás azonosító=' .$this->megbizas->id_ticket_installment_request); \Yii::info('A megbízás feldolgozásának megszakítása. A megbízás már elfogadott: megbízás azonosító=' .$this->megbizas->id_ticket_installment_request);
return; return;
} }
if ( !isset($this->tetel)){ if ( !isset($this->tetel)){
\Yii::info('A megbízás feldolgozásának megszakítása. Nincs valaszsor a detsta üzenetben'); \Yii::info('A megbízás feldolgozásának megszakítása. Nincs válasz sor a detsta üzenetben');
return; return;
} }
@ -75,6 +76,8 @@ class DetStatTetelProcessor extends Object {
if ( $this->status == TicketInstallmentRequest::$STATUS_ACCEPTED ){ if ( $this->status == TicketInstallmentRequest::$STATUS_ACCEPTED ){
$this->buyNewTicket(); $this->buyNewTicket();
}else if ( $this->status == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL ){
$this->putTicketToCustomerCart();
}else{ }else{
$this->doRejectRequest(); $this->doRejectRequest();
} }
@ -86,14 +89,17 @@ class DetStatTetelProcessor extends Object {
$this->eredetiMegbizasStatus = $this->megbizas->status; $this->eredetiMegbizasStatus = $this->megbizas->status;
} }
/**
* @return bool
*/
protected function isEredetiMegbizasStatusFinished(){ protected function isEredetiMegbizasStatusFinished(){
return $this->eredetiMegbizasStatus == TicketInstallmentRequest::$STATUS_ACCEPTED || return TicketInstallmentRequest::$STATUS_ACCEPTED == $this->eredetiMegbizasStatus ||
$this->eredetiMegbizasStatus == TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL || TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL == $this->eredetiMegbizasStatus ||
$this->eredetiMegbizasStatus == TicketInstallmentRequest::$STATUS_REJECTED; TicketInstallmentRequest::$STATUS_REJECTED == $this->eredetiMegbizasStatus;
} }
protected function buyNewTicket(){ protected function buyNewTicket(){
\Yii::info('Új bérlet vásárlás folyamant indítása' ); \Yii::info('Új bérlet vásárlás folyamat indítása' );
$megbizas = $this->megbizas; $megbizas = $this->megbizas;
$customer = $this->contract->customer; $customer = $this->contract->customer;
@ -123,6 +129,39 @@ class DetStatTetelProcessor extends Object {
$this->updateContractOnSuccess(); $this->updateContractOnSuccess();
$this->updateMegbizasOnSuccess(); $this->updateMegbizasOnSuccess();
}
protected function putTicketToCustomerCart(){
\Yii::info('Új bérlet vásárló kosarába helyezés folyamat indítása' );
$megbizas = $this->megbizas;
$customer = $this->contract->customer;
$card = $customer->card;
$account = Account::findOne(1);
$ticketType = $this->contract->ticketType;
$discount = $this->contract->discount;
$ticketSale = new TicketSale(
[
'ticketType'=> $ticketType,
'customer'=> $customer,
'account'=> $account,
'card'=> $card,
'discount'=> $discount,
'contract'=> $this->contract,
'ticketInstallmentRequest' => $megbizas,
'transferStatus' => Transfer::STATUS_NOT_PAID
]
);
$ticketSale->doSale();
\Yii::info('Bérlet és tranzakció elmentve' );
$this->transfer = $ticketSale->transfer;
$this->ticket = $ticketSale->ticket;
$this->updateContractOnSuccess();
$this->updateMegbizasOnSuccess();
} }
/** /**
@ -139,7 +178,7 @@ class DetStatTetelProcessor extends Object {
* */ * */
protected function updateMegbizasOnSuccess(){ protected function updateMegbizasOnSuccess(){
\Yii::info('Megbízás frissítése - megbizás elfogadva ' ); \Yii::info('Megbízás frissítése - megbízás elfogadva ' );
$this->megbizas->status = $this->status; $this->megbizas->status = $this->status;
$this->megbizas->id_transfer = $this->transfer->id_transfer; $this->megbizas->id_transfer = $this->transfer->id_transfer;
@ -161,7 +200,7 @@ class DetStatTetelProcessor extends Object {
* */ * */
protected function updateMegbizasOnFail(){ protected function updateMegbizasOnFail(){
\Yii::info('Megbázás frissítése - megbízás visszautasítva ' ); \Yii::info('Megbízás frissítése - megbízás visszautasítva ' );
$this->megbizas->status = $this->status; $this->megbizas->status = $this->status;
$this->megbizas->detsta_answer = $this->kod; $this->megbizas->detsta_answer = $this->kod;
@ -269,12 +308,12 @@ class DetStatTetelProcessor extends Object {
if ($this->kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT) { if ($this->kod == GiroDETSTATetel::$INFORMACIO_TELJESITETT) {
$this->status = TicketInstallmentRequest::$STATUS_ACCEPTED; $this->status = TicketInstallmentRequest::$STATUS_ACCEPTED;
} else { } else {
$this->status = TicketInstallmentRequest::$STATUS_REJECTED; $this->status = TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL;
} }
\Yii::info('Visszajelző kód kiolvasva: kod=' .$this->kod); \Yii::info('Visszajelző kód kiolvasva: kod=' .$this->kod);
\Yii::info('Visszajelző kód kiolvasva: statusz=' .$this->status. " (" . TicketInstallmentRequest::toStatusName($this->status) .")"); \Yii::info('Visszajelző kód kiolvasva: statusz=' .$this->status. " (" . TicketInstallmentRequest::toStatusName($this->status) .")");
} }
protected function isAlreadeyAccepted() { protected function isAlreadyAccepted() {
return $this->megbizas->isStatusAccepted (); return $this->megbizas->isStatusAccepted ();
} }
public function hasError() { public function hasError() {

File diff suppressed because one or more lines are too long

View File

@ -77,8 +77,9 @@ class TransferPayout extends \yii\base\Object{
} }
/** /**
* @param common\models\Transfer $transfer the transfer to payout * @param \common\models\Transfer $transfer the transfer to payout
* */ * @throws Exception
*/
protected function payoutTransfer($transfer){ protected function payoutTransfer($transfer){
$transfer->paid_by = $this->idUser; $transfer->paid_by = $this->idUser;

View File

@ -1,7 +1,7 @@
<?php <?php
namespace common\components\giro; namespace common\components\giro;
use common\components\giro\GiroBase; use \common\components\giro\GiroBase;
class GiroBankszamla extends GiroBase{ class GiroBankszamla extends GiroBase{

View File

@ -5,18 +5,43 @@ namespace common\components\giro;
use backend\models\GiroKotegForm; use backend\models\GiroKotegForm;
class GiroBase { class GiroBase {
/**
* @param $input
* @param $hossz
* @param string $pad_string
* @return string
*/
public function mezoKitolt($input, $hossz, $pad_string = "") { public function mezoKitolt($input, $hossz, $pad_string = "") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT); return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
} }
/**
* @param $input
* @param $hossz
* @param string $pad_string
* @return string
*/
public function szamKitolt($input, $hossz, $pad_string = "0") { public function szamKitolt($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT); return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
} }
/**
* @param $input
* @param $hossz
* @param string $pad_string
* @return string
*/
public function szamKitoltJobb($input, $hossz, $pad_string = "0") { public function szamKitoltJobb($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_RIGHT); return str_pad($input, $hossz, $pad_string, STR_PAD_RIGHT);
} }
/**
* @param $input
* @param $hossz
* @param string $pad_string
* @return mixed|string
*/
public function szovegKitolt($input, $hossz, $pad_string = " ") { public function szovegKitolt($input, $hossz, $pad_string = " ") {
$data = $input; $data = $input;
$data = GiroKotegForm::transliterate($data); $data = GiroKotegForm::transliterate($data);
@ -29,14 +54,31 @@ class GiroBase {
return $data; return $data;
} }
/**
* @param $row
* @param $start
* @param $length
* @param string $padchar
* @return string
*/
public static function szovegOlvas($row, $start, $length, $padchar = " "){ public static function szovegOlvas($row, $start, $length, $padchar = " "){
return rtrim(substr($row, $start,$length),$padchar); return rtrim(substr($row, $start,$length),$padchar);
} }
/**
* @param $row
* @param $start
* @param $length
* @param string $padchar
* @return string
*/
public static function szamOlvas($row, $start, $length, $padchar = "0"){ public static function szamOlvas($row, $start, $length, $padchar = "0"){
return ltrim(substr($row, $start,$length),$padchar); return ltrim(substr($row, $start,$length),$padchar);
} }
/**
* @return string
*/
public function rekordVege(){ public function rekordVege(){
return "\r\n"; return "\r\n";
} }

View File

@ -2,12 +2,11 @@
namespace common\components\giro; namespace common\components\giro;
use common\components\giro\GiroBase;
/** /**
*@property common\components\giro\GiroBeszedFej $fej *@property \common\components\giro\GiroBeszedFej $fej
*@property common\components\giro\GiroBeszedLab $lab *@property \common\components\giro\GiroBeszedLab $lab
*@property common\components\giro\GiroBeszedTetel[] $tetelek *@property \common\components\giro\GiroBeszedTetel[] $tetelek
* *
*/ */
class GiroBeszed extends GiroBase { class GiroBeszed extends GiroBase {
@ -20,6 +19,13 @@ class GiroBeszed extends GiroBase {
} }
/**
* @param $number
* @param $datum
* @param $requests
* @param null $terhelesiDatum
* @return string
*/
public static function createFileContent($number, $datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) { public static function createFileContent($number, $datum /**összeállítás dátum*/, $requests, $terhelesiDatum = null) {
if ( !isset($terhelesiDatum)){ if ( !isset($terhelesiDatum)){
$terhelesiDatum = date('Ymd' ,strtotime("+5 day")); $terhelesiDatum = date('Ymd' ,strtotime("+5 day"));
@ -31,6 +37,11 @@ class GiroBeszed extends GiroBase {
return $s; return $s;
} }
/**
* @param $number
* @param $daturm
* @return string
*/
public static function createFej($number, $daturm) { public static function createFej($number, $daturm) {
$fej = new GiroBeszedFej (); $fej = new GiroBeszedFej ();
$fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod']; $fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod'];
@ -45,6 +56,11 @@ class GiroBeszed extends GiroBase {
return $fej->toString (); return $fej->toString ();
} }
/**
* @param $requests
* @param $terhelesiDatum
* @return string
*/
public static function createTetelek($requests, $terhelesiDatum){ public static function createTetelek($requests, $terhelesiDatum){
$s = ""; $s = "";
$i = 0; $i = 0;
@ -56,8 +72,10 @@ class GiroBeszed extends GiroBase {
} }
/** /**
* @param common\models\TicketInstallmentRequest $request * @param \common\models\TicketInstallmentRequest $request
* */ *
* @return string
*/
public static function createTetel($request,$sorszam,$terhelesiDatum) { public static function createTetel($request,$sorszam,$terhelesiDatum) {
$tetel = new GiroBeszedTetel (); $tetel = new GiroBeszedTetel ();
$customer = $request->customer; $customer = $request->customer;
@ -75,6 +93,10 @@ class GiroBeszed extends GiroBase {
return $tetel->toString(); return $tetel->toString();
} }
/**
* @param $requests
* @return string
*/
public static function createLab($requests) { public static function createLab($requests) {
$lab = new GiroBeszedLab (); $lab = new GiroBeszedLab ();
@ -90,6 +112,9 @@ class GiroBeszed extends GiroBase {
} }
/**
* @return string
*/
public function toString( ) { public function toString( ) {
$s = ""; $s = "";
$s .= $this->fej->toString(); $s .= $this->fej->toString();

View File

@ -2,13 +2,12 @@
namespace common\components\giro; namespace common\components\giro;
use common\components\giro\GiroBase;
/** /**
* *
* @property common\components\giro\GiroDETSTAFej $fej * @property \common\components\giro\GiroDETSTAFej $fej
* @property common\components\giro\GiroDETSTALab $lab * @property \common\components\giro\GiroDETSTALab $lab
* @property common\components\giro\GiroDETSTATetel $tetelek * @property \common\components\giro\GiroDETSTATetel $tetelek
* *
*/ */
class GiroDETSTA extends GiroBase { class GiroDETSTA extends GiroBase {
@ -48,11 +47,11 @@ class GiroDETSTA extends GiroBase {
} }
/** /**
* @param common\components\giro\GiroBeszed $beszed * @param \common\components\giro\GiroBeszed $beszed
* */ * */
public static function createBeszedAnswer($beszed){ public static function createBeszedAnswer($beszed){
// /**@var common\components\giro\GiroBeszed $beszed*/ // /**@var common\components\giro\GiroBeszed $beszed*/
$beszed = new GiroBeszed(); //$beszed = new GiroBeszed();
$detsta = new GiroDETSTA(); $detsta = new GiroDETSTA();
$detsta->fej = new GiroDETSTAFej(); $detsta->fej = new GiroDETSTAFej();

View File

@ -3,8 +3,8 @@ namespace common\components\giro;
/** /**
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam * @property \common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla * @property \common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */ * */
class GiroDETSTAFej extends GiroBase{ class GiroDETSTAFej extends GiroBase{
@ -35,6 +35,10 @@ class GiroDETSTAFej extends GiroBase{
; ;
} }
/**
* @param $row
* @return GiroDETSTAFej
*/
public static function parse($row){ public static function parse($row){
$fej = new GiroDETSTAFej(); $fej = new GiroDETSTAFej();

View File

@ -4,8 +4,8 @@ namespace common\components\giro;
/** /**
* *
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam * @property \common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla * @property \common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* *
*/ */
class GiroDETSTATetel extends GiroBase { class GiroDETSTATetel extends GiroBase {
@ -23,7 +23,7 @@ class GiroDETSTATetel extends GiroBase {
'99' => "egyéb hiba" '99' => "egyéb hiba"
]; ];
public $recordTipus = "01"; public $recordTipus = "02";
public $tetelSorszam = "0"; public $tetelSorszam = "0";
public $osszeg = "0"; public $osszeg = "0";
public $eredetiTetelElszamolasiDatuma = ""; public $eredetiTetelElszamolasiDatuma = "";

View File

@ -5,7 +5,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.79', 'version' => 'v0.0.80',
'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

@ -23,6 +23,9 @@ use common\components\Helper;
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property string $started_at * @property string $started_at
* @property \common\models\Discount discount
* @property \common\models\Customer customer
* @property \common\models\TicketType ticketType
*/ */
class Contract extends \yii\db\ActiveRecord class Contract extends \yii\db\ActiveRecord
{ {

View File

@ -1,9 +1,7 @@
<?php <?php
namespace common\models; namespace common\models;
use Yii; use Yii;
use common\models\BaseFitnessActiveRecord;
/** /**
* This is the model class for table "customer". * This is the model class for table "customer".
@ -29,6 +27,10 @@ use common\models\BaseFitnessActiveRecord;
* @property string $address * @property string $address
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property \common\models\Card card
* @property integer status
* @property \common\models\User user
* @property mixed bank_account
*/ */
class Customer extends BaseFitnessActiveRecord class Customer extends BaseFitnessActiveRecord
{ {
@ -116,7 +118,7 @@ class Customer extends BaseFitnessActiveRecord
public function getStatusHuman(){ public function getStatusHuman(){
$result = null; $result = null;
$s = self::statuses($this->status); $s = self::statuses( );
if ( array_key_exists($this->status, $s)){ if ( array_key_exists($this->status, $s)){
$result = $s[$this->status]; $result = $s[$this->status];
} }

View File

@ -28,8 +28,10 @@ use common\components\Helper;
* @property string $updated_at * @property string $updated_at
* @property string $detsta_answer * @property string $detsta_answer
* @property string $comment * @property string $comment
* @property string $updated_at * @property \common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból
* @property common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból * @property \common\models\Contract contract
* @property \common\models\Customer customer
* @property string number
*/ */
class TicketInstallmentRequest extends \yii\db\ActiveRecord class TicketInstallmentRequest extends \yii\db\ActiveRecord
{ {
@ -242,9 +244,9 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
/** /**
* @param common\models\Ticket $ticket * @param \common\models\Ticket $ticket
* @param common\models\TicketType $type * @param \common\models\TicketType $type
* @return common\models\TicketInstallmentRequest[] * @return \common\models\TicketInstallmentRequest[]
* */ * */
public static function createInstallments($ticket,$type,$customer,$contract){ public static function createInstallments($ticket,$type,$customer,$contract){
$result = []; $result = [];

View File

@ -18,6 +18,8 @@ use yii\helpers\ArrayHelper;
* @property string $created_at * @property string $created_at
* @property string $updated_at * @property string $updated_at
* @property string $terhelesi_datum * @property string $terhelesi_datum
* @property mixed requests
* @property int status
*/ */
class Ugiro extends \yii\db\ActiveRecord class Ugiro extends \yii\db\ActiveRecord
{ {

View File

@ -2,6 +2,11 @@
namespace console\controllers; namespace console\controllers;
use common\components\giro\GiroDETSTA;
use common\components\giro\GiroDETSTAFej;
use common\components\giro\GiroDETSTALab;
use common\components\giro\GiroDETSTATetel;
use common\models\Ugiro;
use yii\console\Controller; use yii\console\Controller;
use frontend\models\ContractForm; use frontend\models\ContractForm;
use common\models\TicketType; use common\models\TicketType;
@ -39,5 +44,59 @@ class DetstaConsoleController extends Controller{
} }
/**
* @param integer $id_ugiro
*/
public function actionDetstaAnswer($id_ugiro,$accepted = 1){
/** @var \common\models\Ugiro $ugiro */
$ugiro = Ugiro::findOne($id_ugiro);
/** @var \common\components\giro\\GiroDETSTA $detsta */
$detsta = new GiroDETSTA();
/** @var \common\components\giro\GiroDETSTAFej $detsta */
$detsta->fej = new GiroDETSTAFej();
$detsta->fej->jelentesJelzo = 8;
$detsta->fej->kezdemenyezoAzonosito =\Yii::$app->params['ugiro_kezdemenyezo_azonosito'];
$detsta->fej->csoportosUzenetSorszam->osszeallitasDatuma = $ugiro->datum;
$detsta->fej->csoportosUzenetSorszam->sorszam = $ugiro->number;
$detsta->fej->detstaUzenetSorszam->osszeallitasDatuma = $ugiro->datum;
$detsta->fej->detstaUzenetSorszam->sorszam = $ugiro->number;
$detsta->lab = new GiroDETSTALab();
$tetelek = $ugiro->requests;
/** @var \common\models\TicketInstallmentRequest $tetel */
foreach ($tetelek as $tetel ){
$detstaTetel = new GiroDETSTATetel();
$detstaTetel->tetelSorszam = $tetel->number;
$detstaTetel->osszeg = $tetel->money;
$detstaTetel->eredetiTetelElszamolasiDatuma = $ugiro->datum;
if ( $accepted == "1"){
$detstaTetel->visszajelzesInformacio = GiroDETSTATetel::$INFORMACIO_TELJESITETT;
}else{
$detstaTetel->visszajelzesInformacio = '50';
}
$detstaTetel->feldolgozasDatum = $ugiro->datum;
$detstaTetel->terhelesiDatum = $ugiro->datum;
$detstaTetel->valaszHivatkozasiKod = '1234';
$detstaTetel->eredetiHivatkozasiKod = '1234';
$detstaTetel->ugyfelAzonosito = $tetel->customer->id_customer;
$detsta->tetelek[] = $detstaTetel;
}
$content = $detsta->toString();
file_put_contents('c:\tmp\detsta.txt',$content);
}
} }

View File

@ -45,8 +45,9 @@ class ContractController extends Controller {
/** /**
* Lists all Contract models. * Lists all Contract models.
* * @param $id_card
* @return mixed * @return mixed
* @throws \Yii\web\NotFoundHttpException
*/ */
public function actionIndex($id_card) { public function actionIndex($id_card) {
$card = Card::findOne ( $id_card ); $card = Card::findOne ( $id_card );