Finish version/v.0.0.87

This commit is contained in:
Roland Schneider 2016-09-13 21:49:03 +02:00
commit 955e00c369
4 changed files with 94 additions and 39 deletions

View File

@ -1,3 +1,5 @@
-0.0.87
- add console command fix ticket installment request target time
-0.0.86
- add inventory "load sold count" for item fix
- Detstat file > transfer type cash on failed

View File

@ -5,7 +5,7 @@ return [
'supportEmail' => 'rocho02@gmail.com',
'infoEmail' => 'info@rocho-net.hu',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.86',
'version' => 'v0.0.87',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@ -132,7 +132,6 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
public function getTicketExpirationDate(){
$contract = $this->contract;
$started_at = $contract->started_at;
$date = \DateTime::createFromFormat("Y-m-d H:i:s", $started_at, new \DateTimeZone( 'UTC'));
$date = DateUtil::addMonth( $date,$this->priority + 1 );

View File

@ -2,11 +2,14 @@
namespace console\controllers;
use common\components\DateUtil;
use common\components\giro\GiroDETSTA;
use common\components\giro\GiroDETSTAFej;
use common\components\giro\GiroDETSTALab;
use common\components\giro\GiroDETSTATetel;
use common\models\Contract;
use common\models\Ugiro;
use Faker\Provider\DateTime;
use yii\console\Controller;
use frontend\models\ContractForm;
use common\models\TicketType;
@ -14,40 +17,43 @@ use common\models\Customer;
use common\models\Transfer;
class DetstaConsoleController extends Controller{
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();
}
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){
public function actionDetstaAnswer($id_ugiro, $accepted = 1)
{
/** @var \common\models\Ugiro $ugiro */
$ugiro = Ugiro::findOne($id_ugiro);
@ -58,27 +64,26 @@ class DetstaConsoleController extends Controller{
$detsta->fej->jelentesJelzo = 8;
$detsta->fej->kezdemenyezoAzonosito =\Yii::$app->params['ugiro_kezdemenyezo_azonosito'];
$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->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 ){
foreach ($tetelek as $tetel) {
$detstaTetel = new GiroDETSTATetel();
$detstaTetel->tetelSorszam = $tetel->number;
$detstaTetel->osszeg = $tetel->money;
$detstaTetel->eredetiTetelElszamolasiDatuma = $ugiro->datum;
if ( $accepted == "1"){
if ($accepted == "1") {
$detstaTetel->visszajelzesInformacio = GiroDETSTATetel::$INFORMACIO_TELJESITETT;
}else{
} else {
$detstaTetel->visszajelzesInformacio = '50';
}
$detstaTetel->feldolgozasDatum = $ugiro->datum;
@ -92,11 +97,60 @@ class DetstaConsoleController extends Controller{
}
$content = $detsta->toString();
$content = $detsta->toString();
file_put_contents('c:\tmp\detsta.txt',$content);
file_put_contents('c:\tmp\detsta.txt', $content);
}
/**
* Recalculate the request target time at filed for ticket_installment_requests,
* where request status is pending and contract is active
*/
public function actionFixContracts()
{
$query = Contract::find();
/** @var /common/models/Contract[] $contracts */
$contracts = $query->all();
/** @var /common/models/Contract $contract */
foreach ($contracts as $contract) {
if ($contract->isFlagActive()) {
$requests = $contract->requests;
$started_at = $contract->started_at;
for ( $i = 0; $i < 11; $i++ ){
$request = $requests[$i];
/** @var /common/models/TicketInstallmentRequest $request */
$pending = $request->isStatusPending();
if ($pending) {
echo "\nContract: ".$contract->id_contract."; Priority:" . $request->priority . "\n";
$date = \DateTime::createFromFormat("Y-m-d H:i:s", $started_at, new \DateTimeZone( 'UTC'));
$date = DateUtil::addMonth($date, $request->priority);
$date->setTime(0,0,0);
echo "\t".$started_at ." - " . $request->priority . " - ".$request->request_target_time_at . " -> " . $date->format ( 'Y-m-d H:i:s' );
$request->request_target_time_at = $date->format ( 'Y-m-d H:i:s' );
$saved = $request->save(false);
if ( $saved ){
echo " done" ;
}else{
echo " failed";
}
}
}
}
}
}
}
}