102 lines
2.9 KiB
PHP
102 lines
2.9 KiB
PHP
<?php
|
|
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 frontend\models\ContractForm;
|
|
use common\models\TicketType;
|
|
use common\models\Customer;
|
|
use common\models\Transfer;
|
|
|
|
|
|
class DetstaConsoleController extends Controller{
|
|
|
|
|
|
public function actionCreateContract(){
|
|
|
|
|
|
$contractForm = new ContractForm(
|
|
[
|
|
'idAccount' => 1,
|
|
'idUser' => 1
|
|
]
|
|
);
|
|
|
|
$customer = Customer::findOne(5559);
|
|
$contractForm->customer = $customer;
|
|
$contractForm->payment_method = Transfer::PAYMENT_METHOD_TRANSFER;
|
|
|
|
|
|
$contractForm->ticketType = TicketType::find()->andWhere(['status' => TicketType::STATUS_ACTIVE ,'installment_enabled' => '1'])->one();
|
|
|
|
|
|
$start = new \DateTime();
|
|
$startString = $start->format("'Y-m-d");
|
|
|
|
|
|
$contractForm->make();
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @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);
|
|
|
|
}
|
|
|
|
|
|
} |