= $form->field($model, 'id_account')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +HtmlHelper::mkAccountOptions($accounts) ) ?>
+
field($model, 'types')->checkboxList( Transfer::types()) ?>
-
+
= $form->field($model, 'id_user')->dropDownList( ['' => Yii::t('common/transfer', 'All')] +ArrayHelper::map($users,'id' , 'username') ) ?>
+
+ = $form->field($model, 'status')->dropDownList( ['' => "Mind"] + Transfer::statuses() ) ?>
+
diff --git a/backend/views/transfer/index.php b/backend/views/transfer/index.php
index 02ad157..946593c 100644
--- a/backend/views/transfer/index.php
+++ b/backend/views/transfer/index.php
@@ -75,6 +75,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'money',
'value' => 'signedMoney'
],
+ [
+ 'attribute' => 'status',
+ 'value' => 'statusName'
+ ],
'created_at:datetime',
'paid_at:datetime',
diff --git a/common/components/Helper.php b/common/components/Helper.php
index d8b3a75..71a6fde 100644
--- a/common/components/Helper.php
+++ b/common/components/Helper.php
@@ -5,6 +5,11 @@ namespace common\components;
use \Yii;
class Helper {
+
+ public static function getDateTimeString(){
+ return date("Y-m-d H:i:s");
+ }
+
public static function hufRound($m) {
$result = round ( $m / 5, 0 ) * 5;
return $result;
diff --git a/common/models/CardSearch.php b/common/models/CardSearch.php
index 3cb6525..1b5c4e7 100644
--- a/common/models/CardSearch.php
+++ b/common/models/CardSearch.php
@@ -60,6 +60,8 @@ class CardSearch extends Card
$query->select(['card.id_card as card_id_card', 'card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']);
$query->from('card');
$query->innerJoin('customer','card.id_card = customer.id_customer_card');
+ $query->leftJoin("card_key_assignment", 'card.id_card = card_key_assignment.id_card');
+ $query->leftJoin("key", 'key.id_key = card_key_assignment.id_key');
$query->orderBy(['customer.name' => SORT_ASC]);
@@ -77,9 +79,18 @@ class CardSearch extends Card
return $dataProvider;
}
- $query->andFilterWhere([
-// 'lower(customer.name)' => $this->customerName
- ]);
+// $query->andFilterWhere([
+// 'lower(card.number)' => $this->customerName
+// ]);
+
+ if ( !empty($this->number)){
+ $query->andWhere(['or',
+ ['and',[ 'in','card.number' , [$this->number]],"trim(coalesce(card.number, '')) <>'' " ],
+ ['and', ['in','card.rfid_key' ,[ $this->number] ],"trim(coalesce(card.rfid_key, '')) <>'' "],
+ ['and',[ 'in','key.number' , [$this->number]],"trim(coalesce(key.number, '')) <>'' " ],
+ ['and', ['in','key.rfid_key' ,[ $this->number] ],"trim(coalesce(key.rfid_key, '')) <>'' "]
+ ]);
+ }
$query->andFilterWhere(['like', 'customer.name', $this->customerName]);
diff --git a/common/models/MoneyMovement.php b/common/models/MoneyMovement.php
index b111181..91103e7 100644
--- a/common/models/MoneyMovement.php
+++ b/common/models/MoneyMovement.php
@@ -152,7 +152,7 @@ class MoneyMovement extends \yii\db\ActiveRecord
public static function toStatusName($id_status){
$result = "Ismeretlen";
- $statuses = Ticket::statuses();
+ $statuses = MoneyMovement::statuses();
if ( array_key_exists($id_status, $statuses)){
$result = $statuses[$id_status];
}
diff --git a/common/models/TicketInstallmentRequest.php b/common/models/TicketInstallmentRequest.php
index 4f7fc7f..f331594 100644
--- a/common/models/TicketInstallmentRequest.php
+++ b/common/models/TicketInstallmentRequest.php
@@ -5,6 +5,7 @@ namespace common\models;
use Yii;
use yii\helpers\ArrayHelper;
use yii\behaviors\TimestampBehavior;
+use common\components\Helper;
/**
* This is the model class for table "ticket_installment_request".
@@ -25,6 +26,9 @@ use yii\behaviors\TimestampBehavior;
* @property string $request_target_time_at
* @property string $created_at
* @property string $updated_at
+ * @property string $detsta_answer
+ * @property string $comment
+ * @property string $updated_at
* @property common\components\giro\GiroDETSTATetel $detstaTetel GiroDetstaTetel record a DetSta fájlból
*/
class TicketInstallmentRequest extends \yii\db\ActiveRecord
@@ -144,6 +148,7 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
$this->status = $status;
$tranfer = $this->addTransfer();
$this->id_transfer = $tranfer->id_transfer;
+ $this->request_processed_at = Helper::getDateTimeString();
$this->save(false);
$this->applyNewTicketState($partRequired);
return true;
@@ -152,6 +157,9 @@ class TicketInstallmentRequest extends \yii\db\ActiveRecord
}
}else{
$this->status = $status;
+ $this->detsta_answer = $visszajelzes;
+ $this->comment = $comment;
+ $this->request_processed_at = Helper::getDateTimeString();
$this->save(false);
$this->applyNewTicketState($partRequired);
return true;
diff --git a/common/models/Transfer.php b/common/models/Transfer.php
index ff8847b..2b15e93 100644
--- a/common/models/Transfer.php
+++ b/common/models/Transfer.php
@@ -580,6 +580,8 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
$query->andFilterWhere(['in' ,'transfer.type', $types]);
+ $query->andWhere(['not in','transfer.status', Transfer::STATUS_STORNO]);
+
if ( $mode == 'created_at'){
self::inInterval($query, 'transfer.created_at', $start, $end);
diff --git a/common/models/TransferTicketSearch.php b/common/models/TransferTicketSearch.php
index 0375dc2..b69ae6d 100644
--- a/common/models/TransferTicketSearch.php
+++ b/common/models/TransferTicketSearch.php
@@ -207,7 +207,7 @@ class TransferTicketSearch extends Transfer
protected function readTickets(){
$query = (new \yii\db\Query());
- $query->select([ 'customer.name as customer_name', 'user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' , 'transfer.count AS ticket_count', 'transfer.money AS ticket_money','transfer.item_price AS ticket_item_price', 'transfer.created_at as ticket_created_at','transfer.paid_at as ticket_paid_at']);
+ $query->select([ 'ticket.id_ticket as ticket_id_ticket', 'customer.name as customer_name', 'user.username as user_name', 'account.name as account_name','ticket_type.name as ticket_type_name' ,'ticket.status as ticket_status', 'transfer.count AS ticket_count', 'transfer.money AS ticket_money','transfer.item_price AS ticket_item_price', 'transfer.created_at as ticket_created_at','transfer.paid_at as ticket_paid_at']);
$query->from('transfer');
$query->andWhere(['transfer.type' => Transfer::TYPE_TICKET]);
$query->innerJoin("ticket", "ticket.id_ticket = transfer.id_object");
diff --git a/console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php b/console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php
new file mode 100644
index 0000000..1713e26
--- /dev/null
+++ b/console/migrations/m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment.php
@@ -0,0 +1,31 @@
+addColumn("ticket_installment_request", "detsta_answer", "string");
+ $this->addColumn("ticket_installment_request", "comment", "string");
+ }
+
+ public function down()
+ {
+ echo "m160122_135105_alter__table__ticket_installment_request__add__column__detsta_code__and__comment cannot be reverted.\n";
+
+ return false;
+ }
+
+ /*
+ // Use safeUp/safeDown to run migration code within a transaction
+ public function safeUp()
+ {
+ }
+
+ public function safeDown()
+ {
+ }
+ */
+}
diff --git a/frontend/controllers/MoneyMovementController.php b/frontend/controllers/MoneyMovementController.php
index 40fb172..94aee92 100644
--- a/frontend/controllers/MoneyMovementController.php
+++ b/frontend/controllers/MoneyMovementController.php
@@ -9,6 +9,7 @@ use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Account;
+use common\models\Transfer;
/**
* MoneyMovementController implements the CRUD actions for MoneyMovement model.
@@ -66,6 +67,7 @@ class MoneyMovementController extends Controller
$model->id_user = Yii::$app->user->id;
$model->type = MoneyMovement::TYPE_OUT;
$model->id_account = Account::readDefault();
+ $model->status = MoneyMovement::STATUS_PAID;
$accounts = Account::read();
@@ -107,9 +109,13 @@ class MoneyMovementController extends Controller
*/
public function actionDelete($id)
{
- $this->findModel($id)->delete();
-
- return $this->redirect(['index']);
+ $model = $this->findModel($id);
+ $transfer = Transfer::find()->andWhere([ 'type' => Transfer::TYPE_MONEY_MOVEMENT_OUT ,'id_object' => $model->id_money_movement])->one();
+
+ $transfer->storno();
+// $this->findModel($id)->delete();
+ return $this->redirect(Yii::$app->request->referrer);
+// return $this->redirect(['index']);
}
/**
diff --git a/frontend/models/ReceptionForm.php b/frontend/models/ReceptionForm.php
index 29f98f6..1f62bf5 100644
--- a/frontend/models/ReceptionForm.php
+++ b/frontend/models/ReceptionForm.php
@@ -51,7 +51,24 @@ class ReceptionForm extends Model
$this->number = str_replace("ö", "0", $this->number);
- $this->card = Card::find()->andWhere(['or', ['and',[ 'in','number' , [$this->number]],"trim(coalesce(number, '')) <>'' " ], ['and', ['in','rfid_key' ,[ $this->number] ],"trim(coalesce(rfid_key, '')) <>'' "]])->one();
+ $query = Card::find();
+ $query->leftJoin("card_key_assignment", 'card.id_card = card_key_assignment.id_card');
+ $query->leftJoin("key", 'key.id_key = card_key_assignment.id_key');
+
+ $query->andWhere(['or',
+ ['and',[ 'in','card.number' , [$this->number]],"trim(coalesce(card.number, '')) <>'' " ],
+ ['and', ['in','card.rfid_key' ,[ $this->number] ],"trim(coalesce(card.rfid_key, '')) <>'' "],
+ ['and',[ 'in','key.number' , [$this->number]],"trim(coalesce(key.number, '')) <>'' " ],
+ ['and', ['in','key.rfid_key' ,[ $this->number] ],"trim(coalesce(key.rfid_key, '')) <>'' "]
+
+ ]);
+
+ $this->card = $query->one();
+
+ if ( $this->card == null ){
+
+ }
+
if ( $this->card != null ){
$this->customer = $this->card->customer;
$this->readValidTickets();
diff --git a/frontend/views/card/_search.php b/frontend/views/card/_search.php
index 9222da1..f2c5a4c 100644
--- a/frontend/views/card/_search.php
+++ b/frontend/views/card/_search.php
@@ -25,7 +25,7 @@ use yii\widgets\ActiveForm;
field($model, 'customerName') ?>
- field($model, 'number') ?>
+ field($model, 'number')->label("Kártya/kulcs szám") ?>
diff --git a/frontend/views/common/_reception.php b/frontend/views/common/_reception.php
index f100672..db8c510 100644
--- a/frontend/views/common/_reception.php
+++ b/frontend/views/common/_reception.php
@@ -37,10 +37,15 @@ use yii\helpers\Html;
"form-control", 'placeholder' =>'Vendég neve']) ?>