add kulcsok, add tartós beszedés, add ticket type with intallments

This commit is contained in:
2016-01-20 14:48:34 +01:00
parent d1638a19de
commit d7cc84e78f
111 changed files with 4077 additions and 12 deletions

View File

@@ -252,6 +252,10 @@ class DailyListing
$query->andFilterWhere(['or' , $created_condition , $paid_condition]);
$query->andWhere(['transfer.status' => Transfer::STATUS_PAID]);
if ( $this->isModeReception() || $this->isModeAccountState() ){
$query->andWhere(['transfer.payment_method' => Transfer::PAYMENT_METHOD_CASH]);
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
class GiroBankszamla extends GiroBase{
// public $bankszerv;
public $szamlaszam;
public function toString(){
return $this->szovegKitolt( $this->szamlaszam, 24 );
}
}

View File

@@ -0,0 +1,43 @@
<?php
namespace common\components\giro;
use backend\models\GiroKotegForm;
class GiroBase {
public function mezoKitolt($input, $hossz, $pad_string = "") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
}
public function szamKitolt($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_LEFT);
}
public function szamKitoltJobb($input, $hossz, $pad_string = "0") {
return str_pad($input, $hossz, $pad_string, STR_PAD_RIGHT);
}
public function szovegKitolt($input, $hossz, $pad_string = " ") {
$data = $input;
$data = GiroKotegForm::transliterate($data);
if ( strlen($data) > $hossz){
$data = substr($data, 0, $hossz );
}
$data = str_pad($data, $hossz, $pad_string, STR_PAD_RIGHT);
echo $data;
// echo strlen($data);
return $data;
}
public function szovegOlvas($row,$start,$length, $padchar = " "){
return rtrim(substr($row, $start,$length),$padchar);
}
public function szamOlvas($row,$start,$length, $padchar = "0"){
return ltrim(substr($row, $start,$length),$padchar);
}
public function rekordVege(){
return "\r\n";
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
*
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroBeszed extends GiroBase {
public function __construct() {
}
public static function createFileContent($id, $requests) {
$s = self::createFej($id);
$s .= self::createTetelek($requests);
$s .= self::createLab($requests);
return $s;
}
public static function createFej($id) {
$fej = new GiroBeszedFej ();
$fej->duplumKod = \Yii::$app->params['ugiro_duplom_kod'];
$fej->kezdemenyezoAzonosito = \Yii::$app->params['ugiro_kezdemenyezo_azonosito'];//"A25366936T244"; // "66658092128";
$fej->uzenetSorszam->osszeallitasDatuma = date('Ymd' );
$fej->uzenetSorszam->sorszam = $id;
$fej->kezdemenyezoBankszamla->szamlaszam = \Yii::$app->params['ugiro_kezdemenyezo_szamlaszam']; // "5860025215371128";
// $fej->kezdemenyezoBankszamla->bankszerv = "58600252"; // "TAKBHUHB";
$fej->ertesitesiHatarido = "";
$fej->kezdemenyezoCegNeve = \Yii::$app->params['company'];
return $fej->toString ();
}
public static function createTetelek($requests){
$s = "";
foreach ($requests as $request){
$s .= self::createTetel($request);
}
return $s;
}
/**
* @param common\models\TicketInstallmentRequest $request
* */
public static function createTetel($request) {
$tetel = new GiroBeszedTetel ();
$customer = $request->customer;
$tetel->tetelSorszam = $request->id_ticket_installment_request;
$tetel->terhelesiDatum = date('Ymd' ,strtotime("+5 day"));;
$tetel->osszeg = $request->money;
// $tetel->kotelezettBankszamla->bankszerv = "58600252";
$tetel->kotelezettBankszamla->szamlaszam = $customer->bank_account;
$tetel->ugyfelazonositoAKezdemenyezonel = $customer->id_customer;
// $tetel->ugyfelNeve = "Schneider Roland";
// $tetel->ugyfelCime = "Mosonmagyarovar, Gardonyi 31";
$tetel->szamlaTulajdonosNeve = $customer->name;
$tetel->kozlemeny = "Berlet :" . $request->id_ticket;
return $tetel->toString();
}
public static function createLab($requests) {
$lab = new GiroBeszedLab ();
$osszeg = 0;
foreach ($requests as $request ){
$osszeg += $request->money;
}
$lab->tetelekOsszerteke = $osszeg;
$lab->tetelekSzama = count($requests);
return $lab->toString ();
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace common\components\giro;
/**
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */
class GiroBeszedFej extends GiroBase{
public $recordTipus = "01";
public $uzenetTipus = "BESZED";
public $duplumKod = "";
public $kezdemenyezoAzonosito = "";
public $uzenetSorszam;
public $kezdemenyezoBankszamla;
public $ertesitesiHatarido;
public $jogcim = "BEE";
public $kezdemenyezoCegNeve;
public $kozlemeny;
public function __construct(){
$this->uzenetSorszam = new GiroUzenetsorszam();
$this->kezdemenyezoBankszamla = new GiroBankszamla();
}
public function toString( ) {
return $this->recordTipus
.$this->uzenetTipus
. $this->duplumKod
. $this->szamKitolt( $this->kezdemenyezoAzonosito , 13)
. $this->uzenetSorszam->toString()
. $this->kezdemenyezoBankszamla->toString()
. $this->szamKitolt($this->ertesitesiHatarido,8)
. $this->jogcim
. $this->szovegKitolt($this->kezdemenyezoCegNeve, 35)
. $this->szovegKitolt($this->kozlemeny, 70)
. $this->rekordVege()
;
}
}

View File

@@ -0,0 +1,30 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */
class GiroBeszedLab extends GiroBase{
public $rekordTipus = "03";
public $tetelekSzama = 0;
public $tetelekOsszerteke = 0;
public function GiroBeszedLab(){
}
public function toString(){
return $this->rekordTipus
. $this->szamKitolt($this->tetelekSzama,6)
. $this->szamKitolt($this->tetelekOsszerteke,16)
. $this->rekordVege()
;
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kotelezettBankszamla
* */
class GiroBeszedTetel extends GiroBase{
public $rekordTipus = "02";
public $tetelSorszam = 0;
public $terhelesiDatum = "";
public $osszeg;
public $kotelezettBankszamla;
public $ugyfelazonositoAKezdemenyezonel;
public $ugyfelNeve;
public $ugyfelCime;
public $szamlaTulajdonosNeve;
public $kozlemeny;
public function __construct(){
$this->kotelezettBankszamla = new GiroBankszamla();
}
public function toString(){
return $this->rekordTipus
. $this->szamKitolt($this->tetelSorszam,6)
. $this->terhelesiDatum
. $this->szamKitolt($this->osszeg, 10)
. $this->kotelezettBankszamla->toString()
. $this->szovegKitolt($this->ugyfelazonositoAKezdemenyezonel ,24)
. $this->szovegKitolt( $this->ugyfelNeve ,35 )
. $this->szovegKitolt($this->ugyfelCime , 35 )
. $this->szovegKitolt($this->szamlaTulajdonosNeve , 35 )
. $this->szovegKitolt($this->kozlemeny , 70 )
. $this->rekordVege()
;
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
/**
*
* @property common\components\giro\GiroUzenetsorszam $uzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroDETSTA extends GiroBase {
public $fej;
public $lab;
public $tetelek = [];
public function __construct() {
}
public static function parse($content){
$detsta = new GiroDETSTA();
$array = preg_split("/\r\n|\n|\r/", $content);
$detsta->fej = GiroDETSTAFej::parse($array[0]);
$detsta->lab = GiroDETSTALab::parse($array[count($array) -1]);
for ( $i = 1 ; $i < count($array) -1; $i++ ){
$row = $array[$i];
$tetel = GiroDETSTATetel::parse($row);
$detsta->tetelek[] = $tetel;
}
return $detsta;
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace common\components\giro;
/**
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
* */
class GiroDETSTAFej extends GiroBase{
public $recordTipus = "01";
public $uzenetTipus = "DETSTA";
public $jelentesJelzo = "9";
public $kezdemenyezoAzonosito = "";
public $csoportosUzenetSorszam;
public $detstaUzenetSorszam;
public $ido;
public function __construct(){
$this->csoportosUzenetSorszam = new GiroUzenetsorszam();
$this->detstaUzenetSorszam = new GiroUzenetsorszam();
}
public function toString( ) {
return $this->recordTipus
.$this->uzenetTipus
. $this->jelentesJelzo
. $this->szamKitolt( $this->kezdemenyezoAzonosito , 13)
. $this->csoportosUzenetSorszam->toString()
. $this->detstaUzenetSorszam->toString()
. $this->ido
. $this->rekordVege()
;
}
public static function parse($row){
$fej = new GiroDETSTAFej();
$fej->recordTipus = substr($row,0,2 );
$fej->uzenetTipus = substr($row, 2,6 );
$fej->jelentesJelzo = substr($row, 8,1);
$fej->kezdemenyezoAzonosito = substr($row, 9,13);
$fej->csoportosUzenetSorszam ->osszeallitasDatuma = substr($row, 22, 8);
$fej->csoportosUzenetSorszam->sorszam = substr($row, 30, 4);
$fej->detstaUzenetSorszam ->osszeallitasDatuma = substr($row, 34,8);
$fej->detstaUzenetSorszam->sorszam = substr($row, 42,4);
$fej->ido = substr($row, 46,6);
return $fej;
}
}

View File

@@ -0,0 +1,44 @@
<?php
namespace common\components\giro;
/**
*
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroDETSTALab extends GiroBase {
public $recordTipus = "03";
public $teljesitettTetelekSzama = "0";
public $teljesitettTetelekOsszerteke = "0";
public $visszautasitottTetelekSzama = "0";
public $visszautasitottTetelekOsszerteke = "0";
public $megNemValaszoltTetelekSzama = "0";
public $megNemValaszoltTetelekOsszerteke = "0";
public function __construct() {
}
public function toString() {
return $this->recordTipus
. $this->szamKitolt ( $this->teljesitettTetelekSzama, 6 )
. $this->szamKitolt ( $this->teljesitettTetelekOsszerteke, 16 )
. $this->szamKitolt ( $this->visszautasitottTetelekSzama, 6 )
. $this->szamKitolt ( $this->visszautasitottTetelekOsszerteke, 16 )
. $this->szamKitolt ( $this->megNemValaszoltTetelekSzama, 6 )
. $this->szamKitolt ( $this->megNemValaszoltTetelekOsszerteke, 16 )
. $this->rekordVege();
;
}
public static function parse($row) {
$lab = new GiroDETSTALab ();
$lab->recordTipus = substr($row,0,2 );
$lab->teljesitettTetelekSzama = substr($row,2,6 );
$lab->teljesitettTetelekOsszerteke = substr($row,8,16 );
$lab->visszautasitottTetelekSzama = substr($row,24,6 );
$lab->visszautasitottTetelekOsszerteke = substr($row,30,16 );
$lab->megNemValaszoltTetelekSzama = substr($row,46,6 );
$lab->megNemValaszoltTetelekOsszerteke = substr($row,52, 16 );
return $lab;
}
}

View File

@@ -0,0 +1,61 @@
<?php
namespace common\components\giro;
/**
*
* @property common\components\giro\GiroUzenetsorszam $csoportosUzenetSorszam
* @property common\components\giro\GiroBankszamla $kezdemenyezoBankszamla
*
*/
class GiroDETSTATetel extends GiroBase {
public static $INFORMACIO_TELJESITETT = "00";
public static $INFORMACIO_VISSZAUTASIOTT_VALASZ_NELKUL = "NO";
public static $INFORMACIOK = [
'02' => "nem létező 'címzett' számlaszám",
'03' => "megszűnt 'címzett' számlaszám",
'06' => "a 'címzett' számlaszáma nem értelmezhető (az ügyfél számlaszáma helyett a bank ügyfélforgalmi számlaszáma szerepel)",
'10' => "a számlatulajdonos neve és a megadott számlaszám nem tartozik össze szemantikai, 'teljesíthetetlen' ok miatti visszaküldés (RETURN)",
'50' => "fedezethiány miatti visszaküldés",
'51' => "felhatalmazás hiánya miatti visszaküldés",
'54' => "általános visszaküldés (az ügyfél megbízása alapján)",
'65' => "összeghatár feletti beszedési megbízás",
'99' => "egyéb hiba"
];
public $recordTipus = "01";
public $tetelSorszam = "0";
public $osszeg = "0";
public $eredetiTetelElszamolasiDatuma = "";
public $visszajelzesInformacio;
public $feldolgozasDatum;
public $terhelesiDatum;
public $valaszHivatkozasiKod;
public $eredetiHivatkozasiKod;
public $ugyfelAzonosito;
public function __construct() {
$this->csoportosUzenetSorszam = new GiroUzenetsorszam ();
$this->detstaUzenetSorszam = new GiroUzenetsorszam ();
}
public function toString() {
return $this->recordTipus . $this->szamKitolt ( $this->tetelSorszam, 6 ) . $this->szamKitolt ( $this->osszeg, 10 ) . $this->eredetiTetelElszamolasiDatuma . $this->visszajelzesInformacio . $this->feldolgozasDatum . $this->terhelesiDatum . $this->szovegKitolt ( $this->valaszHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->eredetiHivatkozasiKod, 29 ) . $this->szovegKitolt ( $this->ugyfelAzonosito, 29 );
}
public static function parse($row) {
$tetel = new GiroDETSTATetel ();
$tetel->recordTipus = substr ( $row, 0, 2 );
$tetel->tetelSorszam = substr ( $row, 2, 6 );
$tetel->osszeg = substr ( $row, 8, 10 );
$tetel->eredetiTetelElszamolasiDatuma = substr ( $row, 18, 8 );
$tetel->visszajelzesInformacio = substr ( $row, 26, 2 );
$tetel->feldolgozasDatum = substr ( $row, 28, 8 );
$tetel->terhelesiDatum = substr ( $row, 36, 8 );
$tetel->valaszHivatkozasiKod = substr ( $row, 44, 29 );
$tetel->eredetiHivatkozasiKod = substr ( $row, 73, 29 );
$tetel->ugyfelAzonosito = substr ( $row, 102, 24 );
return $tetel;
}
}

View File

@@ -0,0 +1,16 @@
<?php
namespace common\components\giro;
use common\components\giro\GiroBase;
class GiroUzenetsorszam extends GiroBase{
public $osszeallitasDatuma;
public $sorszam;
public function toString( ) {
return $this->osszeallitasDatuma . $this->szamKitolt( $this->sorszam,4);
}
}
?>