add editable account on reception/customer-cart, add towel handling

This commit is contained in:
2016-10-21 20:39:02 +02:00
parent 8585286150
commit 90c598f8c6
26 changed files with 649 additions and 37 deletions

View File

@@ -30,10 +30,11 @@ class TransferPayout extends \yii\base\Object{
/**Ha a fizetési módot meg szeretnél változtatni*/
public $overridePaymentMethod = null;
/**Ha a fizetési Kasszát meg szeretné változtatni.
* Fizetési kasszát csak bankártyásra lehet változtatni*/
public $overrideIdAccount = null;
public function payout(){
@@ -85,15 +86,21 @@ class TransferPayout extends \yii\base\Object{
$transfer->paid_by = $this->idUser;
$transfer->status = Transfer::STATUS_PAID;
$transfer->paid_at = date('Y-m-d H:i:s' );
$account = $transfer->account;
if ( isset($account )){
/**Ha a tranzakció eredet kasszája látható típusu, akkor változtathatjuk az atuális kasszára. Különben nem*/
if ($account->type == Account::TYPE_ALL){
$transfer->id_account = Account::readDefault();
}
}
if ( isset($this->overrideIdAccount) && !empty($this->overrideIdAccount)){
$transfer->id_account = $this->overrideIdAccount;
}else{
$account = $transfer->account;
if ( isset($account )){
/**Ha a tranzakció eredeti kasszája látható típusú, akkor változtathatjuk az atuális kasszára. Különben nem*/
if ($account->type == Account::TYPE_ALL){
$transfer->id_account = Account::readDefault();
}
}
}
\Yii::info("fizetési mód: " . $this->overridePaymentMethod);

View File

@@ -16,6 +16,7 @@ use common\components\Helper;
* @property string $created_at
* @property string $updated_at
* @property int flag_out
* @property \common\models\Customer $customer relation
*/
class Card extends \common\models\BaseFitnessActiveRecord
{

View File

@@ -16,6 +16,7 @@ class CardSearch extends Card
{
public $customerName;
public $towel;
/**
* @inheritdoc
*/
@@ -23,7 +24,8 @@ class CardSearch extends Card
{
return [
['customerName','string','max' =>200],
['number','string','max' =>200]
['number','string','max' =>200],
['towel','integer']
];
}
@@ -40,7 +42,8 @@ class CardSearch extends Card
return ArrayHelper::merge(parent::attributeLabels(),
[
'card_number' => 'Kártya szám',
'customerName' => 'Vendég'
'customerName' => 'Vendég',
'towel' => 'Törölköző'
]
);
@@ -57,7 +60,7 @@ class CardSearch extends Card
{
$query = new Query();
$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->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','customer.towel_count as towel_count']);
$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');
@@ -85,6 +88,10 @@ class CardSearch extends Card
'asc' => ['customer.email' => SORT_ASC ],
'desc' => ['customer.email' => SORT_DESC],
],
'towel_count' => [
'asc' => ['customer.towel_count' => SORT_ASC ],
'desc' => ['customer.towel_count' => SORT_DESC],
],
],
'defaultOrder' =>[
'customer_name' => SORT_ASC,
@@ -115,6 +122,10 @@ class CardSearch extends Card
]);
}
if ( isset($this->towel) && !empty($this->towel)){
$query->andWhere(['>','customer.towel_count',0]);
}
$query->andFilterWhere(['like', 'customer.name', $this->customerName]);
return $dataProvider;

View File

@@ -29,6 +29,7 @@ use Yii;
* @property string $updated_at
* @property \common\models\Card card
* @property integer status
* @property integer towel_count
* @property \common\models\User user
* @property mixed bank_account
*/
@@ -47,6 +48,7 @@ class Customer extends BaseFitnessActiveRecord
public $photo_data;
/**
* @inheritdoc
*/

View File

@@ -51,6 +51,8 @@ class Log extends BaseFitnessActiveRecord
public static $TYPE_NEWSLETTER_SEND_END = 160;
public static $TYPE_KEY_ASSIGN = 170;
public static $TYPE_KEY_UNASSIGN = 180;
public static $TYPE_TOWEL_IN = 190;
public static $TYPE_TOWEL_OUT = 200;
/**
* @inheritdoc