Finish version/v.0.0.40
This commit is contained in:
commit
280870c071
@ -56,7 +56,13 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'id_user',
|
'attribute' => 'id_user',
|
||||||
'value' => 'userName'
|
'value' => 'userName' ,
|
||||||
|
'label' => 'Kiadta' ,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'attribute' => 'paid_by',
|
||||||
|
'value' => 'paidByName' ,
|
||||||
|
'label' => 'Fizette'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'attribute' => 'id_account',
|
'attribute' => 'id_account',
|
||||||
|
|||||||
@ -1,3 +1,8 @@
|
|||||||
|
-0.0.40
|
||||||
|
- fix contract pdf design
|
||||||
|
-0.0.39
|
||||||
|
- add TransferPayout
|
||||||
|
- add ContractForm
|
||||||
-0.0.38
|
-0.0.38
|
||||||
- add backend skin
|
- add backend skin
|
||||||
- add import add/edit to key
|
- add import add/edit to key
|
||||||
|
|||||||
63
common/components/Azaz.php
Normal file
63
common/components/Azaz.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components;
|
||||||
|
|
||||||
|
class Azaz
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->EgyesStr = array('', 'egy', 'kettő', 'három', 'négy', 'öt', 'hat', 'hét', 'nyolc', 'kilenc');
|
||||||
|
$this->TizesStr = array('', 'tíz', 'húsz', 'harminc', 'negyven', 'ötven', 'hatvan', 'hetven', 'nyolcvan', 'kilencven');
|
||||||
|
$this->TizenStr = array('', 'tizen', 'huszon', 'harminc', 'negyven', 'ötven', 'hatvan', 'hetven', 'nyolcvan', 'kilencven');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function toString($Mit)
|
||||||
|
{
|
||||||
|
$this->Mit = $Mit;
|
||||||
|
$this->Result = '';
|
||||||
|
if ($Mit == 0)
|
||||||
|
{
|
||||||
|
$this->Result = 'Nulla';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->Maradek = abs($this->Mit);
|
||||||
|
if ($this->Maradek > 999999999999)
|
||||||
|
{
|
||||||
|
throw new Exception('Túl nagy szám: '.$this->Maradek);
|
||||||
|
}
|
||||||
|
$this->Alakit($this->Maradek, 1000000000, 'milliárd');
|
||||||
|
$this->Alakit($this->Maradek, 1000000, 'millió');
|
||||||
|
$this->Alakit($this->Maradek, 1000, 'ezer');
|
||||||
|
$this->Alakit($this->Maradek, 1, '');
|
||||||
|
$this->Result = ucfirst($this->Result);
|
||||||
|
if ( $Mit < 0 )
|
||||||
|
$this->Result = 'Mínusz ' . $this->Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function Alakit($Maradek, $Oszto, $Osztonev)
|
||||||
|
{
|
||||||
|
if ( $Maradek >= $Oszto)
|
||||||
|
{
|
||||||
|
if ( mb_strlen($this->Result) > 0 )
|
||||||
|
$this->Result = $this->Result . '-';
|
||||||
|
|
||||||
|
$this->Mit = $Maradek / $Oszto;
|
||||||
|
if ( $this->Mit >= 100)
|
||||||
|
$this->Result = $this->Result . $this->EgyesStr[$this->Mit / 100] . 'száz';
|
||||||
|
|
||||||
|
$this->Mit = $this->Mit % 100;
|
||||||
|
if ($this->Mit % 10 !== 0)
|
||||||
|
$this->Result = $this->Result . $this->TizenStr[$this->Mit / 10] . $this->EgyesStr[$this->Mit % 10] . $Osztonev;
|
||||||
|
else
|
||||||
|
$this->Result = $this->Result . $this->TizesStr[$this->Mit / 10] . $Osztonev;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Maradek = $this->Maradek % $Oszto;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -255,6 +255,9 @@ class Helper {
|
|||||||
public static function isUserCartVisibilityUser() {
|
public static function isUserCartVisibilityUser() {
|
||||||
return \Yii::$app->params ['user_cart_item_visibility'] == 'user';
|
return \Yii::$app->params ['user_cart_item_visibility'] == 'user';
|
||||||
}
|
}
|
||||||
|
public static function isUserCartVisibilityAll() {
|
||||||
|
return \Yii::$app->params ['user_cart_item_visibility'] == 'all';
|
||||||
|
}
|
||||||
|
|
||||||
public static function getBackendSkin() {
|
public static function getBackendSkin() {
|
||||||
return \Yii::$app->params ['backend_skin'] ;
|
return \Yii::$app->params ['backend_skin'] ;
|
||||||
|
|||||||
118
common/components/TransferPayout.php
Normal file
118
common/components/TransferPayout.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
namespace common\components;
|
||||||
|
|
||||||
|
|
||||||
|
use common\models\Transfer;
|
||||||
|
use common\models\Account;
|
||||||
|
use yii\base\Exception;
|
||||||
|
use common\models\ShoppingCart;
|
||||||
|
use common\models\UserSoldItem;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TransferPayout extends \yii\base\Object{
|
||||||
|
|
||||||
|
/**Current user*/
|
||||||
|
public $idUser = null;
|
||||||
|
/**id of transfers which we want to payout*/
|
||||||
|
public $idTransfers = [];
|
||||||
|
/** The loaded transfers*/
|
||||||
|
public $transfers = [];
|
||||||
|
|
||||||
|
/**valamilyen kosár kifizetés ( user|customer ) ? */
|
||||||
|
public $cartType;
|
||||||
|
/**Vásárló kosár kifizetése esetén a vásárló azonosító*/
|
||||||
|
public $idCustomer;
|
||||||
|
|
||||||
|
/**Az alapértelmezett kassza!*/
|
||||||
|
public $idAccount;
|
||||||
|
|
||||||
|
/**Ha a fizetési módot meg szeretnél változtatni*/
|
||||||
|
public $overridePaymentMethod = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public function payout(){
|
||||||
|
|
||||||
|
$this->readTransfers();
|
||||||
|
|
||||||
|
|
||||||
|
if ( count($this->transfers ) ==0 ){
|
||||||
|
\Yii::error("TransferPayout - üres lista kifizetés");
|
||||||
|
throw new Exception("Nem található kifizethető tranzakció a listában. ");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( !$this->isTransferCountMatchWithRequestesTransferCount() ){
|
||||||
|
\Yii::error("TransferPayout - input tranzakció azonosítók száma nem egyezik a betöltött tranzakciók számával");
|
||||||
|
throw new Exception("A kifizetni kívánt tranzakciók száma nem egyezik a kifizehtető tranzakciók számával. ");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($this->transfers as $transfer){
|
||||||
|
$this->payoutTransfer($transfer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function readTransfers(){
|
||||||
|
$query = Transfer::find();
|
||||||
|
$query->andWhere([ 'in' , 'transfer.id_transfer' , $this->idTransfers ]);
|
||||||
|
$query->andWhere( ['transfer.status' => Transfer::STATUS_NOT_PAID]) ;
|
||||||
|
|
||||||
|
if ( Helper::isUserCartVisibilityUser()){
|
||||||
|
$query->innerJoin("user" ,"user.id = transfer.id_user");
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->transfers = $query->all();
|
||||||
|
\Yii::info("TransferPayout - betöltött tranzakciók száma:" . count($this->transfers) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ellenőrizzük, hogy annyi tranzakciót töltöttünk e be, mint amennyit parameterként kaptunkk
|
||||||
|
* */
|
||||||
|
public function isTransferCountMatchWithRequestesTransferCount(){
|
||||||
|
return count($this->transfers) == count($this->idTransfers);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param common\models\Transfer $transfer the transfer to payout
|
||||||
|
* */
|
||||||
|
protected function payoutTransfer($transfer){
|
||||||
|
|
||||||
|
$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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
\Yii::info("fizetési mód: " . $this->overridePaymentMethod);
|
||||||
|
if ( isset($this->overridePaymentMethod ) && array_search($this->overridePaymentMethod, array_keys( Transfer::paymentMethods()) ) ){
|
||||||
|
\Yii::info("fizetési mód beállítva: " .$this->overridePaymentMethod );
|
||||||
|
$transfer->payment_method = $this->overridePaymentMethod;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $transfer->save(false) == false ){
|
||||||
|
\Yii::error("Tranzakció kifizetése sikertelen volt: " . $transfer->id_transfer);
|
||||||
|
throw new Exception("Tranzakció fizetése sikertelen volt!");
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
ShoppingCart::deleteAll( ['id_transfer' => $transfer->id_transfer] );
|
||||||
|
UserSoldItem::deleteAll( ['id_transfer' => $transfer->id_transfer] );
|
||||||
|
}catch (\Exception $e){
|
||||||
|
\Yii::error("TransferPayout - tranzakció törlése a kosarakból sikertelen volt. Tranzakció: " . $transfer->id_transfer);
|
||||||
|
throw new Exception("Tranzakció fizetése sikertelen volt!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -4,7 +4,7 @@ return [
|
|||||||
'supportEmail' => 'rocho02@gmail.com',
|
'supportEmail' => 'rocho02@gmail.com',
|
||||||
'infoEmail' => 'info@rocho-net.hu',
|
'infoEmail' => 'info@rocho-net.hu',
|
||||||
'user.passwordResetTokenExpire' => 3600,
|
'user.passwordResetTokenExpire' => 3600,
|
||||||
'version' => 'v0.0.38',
|
'version' => 'v0.0.40',
|
||||||
'company' => 'movar',//gyor
|
'company' => 'movar',//gyor
|
||||||
'company_name' => "Freimann Kft.",
|
'company_name' => "Freimann Kft.",
|
||||||
'product_visiblity' => 'account',// on reception which products to display. account or global
|
'product_visiblity' => 'account',// on reception which products to display. account or global
|
||||||
@ -12,9 +12,9 @@ return [
|
|||||||
/**Kassza nyitáskor küldjünk email-t?*/
|
/**Kassza nyitáskor küldjünk email-t?*/
|
||||||
'mail_account_state_open' => true,
|
'mail_account_state_open' => true,
|
||||||
/**Kassza záráskor küldjünk email-t?*/
|
/**Kassza záráskor küldjünk email-t?*/
|
||||||
'mail_account_state_close' => true,
|
'mail_account_state_close' => false,
|
||||||
'login_reception_email' => true, //if reception login should send email
|
'login_reception_email' => false, //if reception login should send email
|
||||||
'login_admin_email' => true, //if admin login should send email
|
'login_admin_email' => false, //if admin login should send email
|
||||||
'account_state_close_preload_money' => 'true',//preload money wnen show account state close page
|
'account_state_close_preload_money' => 'true',//preload money wnen show account state close page
|
||||||
'ugiro_duplom_kod' => 1,
|
'ugiro_duplom_kod' => 1,
|
||||||
'ugiro_kezdemenyezo_szamlaszam' => '000000000000000',//5860025215371128
|
'ugiro_kezdemenyezo_szamlaszam' => '000000000000000',//5860025215371128
|
||||||
@ -22,10 +22,20 @@ return [
|
|||||||
//a recepicó kosár csak az aktuális user által kiadott termékeket tartalmazza
|
//a recepicó kosár csak az aktuális user által kiadott termékeket tartalmazza
|
||||||
//vagy mindent
|
//vagy mindent
|
||||||
//értékek user|all
|
//értékek user|all
|
||||||
|
// * - user: a felhasználó csak azokat a termékeket látja a kosrába, amiket ő rakott bele
|
||||||
|
// - all: a felhasználó minden kosrában lévő terméket lát, még azokat is , amiket nem ő rakott bele
|
||||||
'user_cart_item_visibility' => 'user',
|
'user_cart_item_visibility' => 'user',
|
||||||
/**
|
/**
|
||||||
* Hány napig láthatják visszamenőleg a recepciósok az adatokat
|
* Hány napig láthatják visszamenőleg a recepciósok az adatokat
|
||||||
* */
|
* */
|
||||||
'reception_visibility_days' => 3,
|
'reception_visibility_days' => 3,
|
||||||
'backend_skin' => 'skin-red', //skin-green
|
'backend_skin' => 'skin-red', //skin-green
|
||||||
|
/**
|
||||||
|
* if products in carts are visible for everyone or only for the user
|
||||||
|
* possible values :
|
||||||
|
* - user: a felhasználó csak azokat a termékeket látja a kosrába, amiket ő rakott bele
|
||||||
|
* - global: a felhasználó minden kosrában lévő terméket lát, még azokat is , amiket nem ő rakott bele
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@ -88,6 +88,9 @@ class Contract extends \yii\db\ActiveRecord
|
|||||||
public function getTicketType(){
|
public function getTicketType(){
|
||||||
return $this->hasOne(TicketType::className(), ['id_ticket_type' => 'id_ticket_type']);
|
return $this->hasOne(TicketType::className(), ['id_ticket_type' => 'id_ticket_type']);
|
||||||
}
|
}
|
||||||
|
public function getTicket(){
|
||||||
|
return $this->hasOne(Ticket::className(), ['id_contract' => 'id_contract']);
|
||||||
|
}
|
||||||
|
|
||||||
public function getCustomer(){
|
public function getCustomer(){
|
||||||
return $this->hasOne(Customer::className(), ['id_customer' => 'id_customer']);
|
return $this->hasOne(Customer::className(), ['id_customer' => 'id_customer']);
|
||||||
@ -179,4 +182,20 @@ class Contract extends \yii\db\ActiveRecord
|
|||||||
public function isFlagActive() {
|
public function isFlagActive() {
|
||||||
return $this->flag == static::$FLAG_ACTIVE;
|
return $this->flag == static::$FLAG_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPriceMonthly(){
|
||||||
|
return $this->ticket->price_brutto;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPartsTotal(){
|
||||||
|
$money = $this->getPriceMonthly();
|
||||||
|
$money = $money * $this->part_count;
|
||||||
|
return $money;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPriceTotal(){
|
||||||
|
$money = $this->getPartsTotal();
|
||||||
|
$money = $money + $this->getPriceMonthly();
|
||||||
|
return $money;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,6 +96,8 @@ class Customer extends \yii\db\ActiveRecord
|
|||||||
'updated_at' => Yii::t('common/customer', 'Updated At'),
|
'updated_at' => Yii::t('common/customer', 'Updated At'),
|
||||||
'customerCardNumber' => Yii::t('common/customer', 'Card number'),
|
'customerCardNumber' => Yii::t('common/customer', 'Card number'),
|
||||||
'cardNumber' => Yii::t('common/customer', 'Card number'),
|
'cardNumber' => Yii::t('common/customer', 'Card number'),
|
||||||
|
'mother_name' => Yii::t('common/customer', 'Anyja neve'),
|
||||||
|
'birth_place' => Yii::t('common/customer', 'Születési hely'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +174,16 @@ class Customer extends \yii\db\ActiveRecord
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFullAddress(){
|
||||||
|
$zip = $this->zip;
|
||||||
|
$city = $this->city;
|
||||||
|
$address = $this->address;
|
||||||
|
|
||||||
|
$result = $zip . " " .$city . ", ". $address;
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
namespace common\models;
|
namespace common\models;
|
||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
|
use common\components\Helper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the model class for table "shopping_cart".
|
* This is the model class for table "shopping_cart".
|
||||||
@ -72,6 +73,8 @@ class ShoppingCart extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
if ( isset($account)){
|
if ( isset($account)){
|
||||||
$sql .= " , id_account = " . $account;
|
$sql .= " , id_account = " . $account;
|
||||||
|
} else if ( Helper::isUserCartVisibilityAll()){
|
||||||
|
$sql .= " , id_account = " . Account::readDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql .= " WHERE t.status = " . Transfer::STATUS_NOT_PAID
|
$sql .= " WHERE t.status = " . Transfer::STATUS_NOT_PAID
|
||||||
|
|||||||
@ -223,9 +223,11 @@ class TicketType extends \common\models\BaseFitnessActiveRecord {
|
|||||||
$ticketTypes = null;
|
$ticketTypes = null;
|
||||||
|
|
||||||
if ( $forceIncludeObjectWithId == null){
|
if ( $forceIncludeObjectWithId == null){
|
||||||
$ticketTypes = TicketType::find()->andWhere(['status' => self::STATUS_ACTIVE])->andFilterWhere(['ticket_type.id_account' => $account])->all();
|
$ticketTypes = TicketType::find()->andWhere(['status' => self::STATUS_ACTIVE ])
|
||||||
|
->andWhere([ '<>', 'installment_enabled' , '1']) ->andFilterWhere(['ticket_type.id_account' => $account])->all();
|
||||||
}else{
|
}else{
|
||||||
$ticketTypes = TicketType::find()->andWhere( ['or', ['status' => self::STATUS_ACTIVE], ['id_ticket_type' => $forceIncludeObjectWithId ] ])->andFilterWhere(['ticket_type.id_account' => $account])->all();
|
$ticketTypes = TicketType::find()->andWhere( ['or', ['status' => self::STATUS_ACTIVE], ['id_ticket_type' => $forceIncludeObjectWithId ] ])
|
||||||
|
->andWhere([ '<>', 'installment_enabled' , '1'])->andFilterWhere(['ticket_type.id_account' => $account])->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ticketTypes;
|
return $ticketTypes;
|
||||||
|
|||||||
@ -488,8 +488,9 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
$transfers = [ ];
|
$transfers = [ ];
|
||||||
|
|
||||||
$query = Transfer::find ();
|
$query = Transfer::find ();
|
||||||
|
$query->innerJoin("user_sold_item","user_sold_item.id_transfer = transfer.id_transfer");
|
||||||
|
|
||||||
$query->innerJoinWith ( 'userSoldItem' );
|
// $query->innerJoinWith ( 'userSoldItem' );
|
||||||
if ( Helper::isUserCartVisibilityUser()){
|
if ( Helper::isUserCartVisibilityUser()){
|
||||||
$query->andWhere ( [
|
$query->andWhere ( [
|
||||||
'user_sold_item.id_user' => $user->id
|
'user_sold_item.id_user' => $user->id
|
||||||
@ -942,6 +943,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function payout() {
|
public function payout() {
|
||||||
|
|
||||||
if ($this->status != Transfer::STATUS_NOT_PAID) {
|
if ($this->status != Transfer::STATUS_NOT_PAID) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -949,14 +951,18 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
$this->status = Transfer::STATUS_PAID;
|
$this->status = Transfer::STATUS_PAID;
|
||||||
$this->paid_at = Helper::getDateTimeString ();
|
$this->paid_at = Helper::getDateTimeString ();
|
||||||
$this->paid_by = \Yii::$app->user->id;
|
$this->paid_by = \Yii::$app->user->id;
|
||||||
ShoppingCart::deleteAll ( [
|
|
||||||
'id_transfer' => $this->id_transfer
|
if( Helper::isUserCartVisibilityAll() ){
|
||||||
] );
|
$this->id_account = Account::readDefault();
|
||||||
UserSoldItem::deleteAll ( [
|
}
|
||||||
'id_transfer' => $this->id_transfer
|
|
||||||
|
ShoppingCart::deleteAll ( [ 'id_transfer' => $this->id_transfer ] );
|
||||||
|
UserSoldItem::deleteAll ( [ 'id_transfer' => $this->id_transfer
|
||||||
] );
|
] );
|
||||||
return $this->save ();
|
return $this->save ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static function payoutAll($id_user, $id_array) {
|
public static function payoutAll($id_user, $id_array) {
|
||||||
ShoppingCart::deleteAll ( [
|
ShoppingCart::deleteAll ( [
|
||||||
'in',
|
'in',
|
||||||
@ -968,24 +974,29 @@ class Transfer extends \common\models\BaseFitnessActiveRecord {
|
|||||||
'id_transfer',
|
'id_transfer',
|
||||||
$id_array
|
$id_array
|
||||||
] );
|
] );
|
||||||
Transfer::updateAll ( [
|
|
||||||
|
$updateConfig = null;
|
||||||
|
if ( Helper::isUserCartVisibilityUser() ){
|
||||||
|
$updateConfig = [
|
||||||
'status' => Transfer::STATUS_PAID,
|
'status' => Transfer::STATUS_PAID,
|
||||||
'paid_at' => Helper::getDateTimeString (),
|
'paid_at' => Helper::getDateTimeString (),
|
||||||
'paid_by' => $id_user
|
'paid_by' => $id_user
|
||||||
], [
|
];
|
||||||
[
|
}else{
|
||||||
'in',
|
$updateConfig = [
|
||||||
'id_transfer',
|
'status' => Transfer::STATUS_PAID,
|
||||||
$id_array
|
'paid_at' => Helper::getDateTimeString (),
|
||||||
],
|
'paid_by' => $id_user,
|
||||||
[
|
'id_account' => Account::readDefault(),
|
||||||
'in',
|
];
|
||||||
'status',
|
}
|
||||||
[
|
|
||||||
Transfer::STATUS_NOT_PAID
|
$updateConditions = [
|
||||||
]
|
[ 'in','id_transfer', $id_array ],
|
||||||
]
|
[ 'in', 'status', [ Transfer::STATUS_NOT_PAID ] ]
|
||||||
] );
|
];
|
||||||
|
|
||||||
|
Transfer::updateAll ( $updateConfig , $updateConditions );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -99,8 +99,12 @@ class UserSoldItem extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
if ( isset($account)){
|
if ( isset($account)){
|
||||||
$sql .= " , id_account = " . $account;
|
$sql .= " , id_account = " . $account;
|
||||||
|
}else if ( Helper::isUserCartVisibilityAll() ){
|
||||||
|
$sql .= " , id_account = " . Account::readDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$sql .= " WHERE t.status = " . Transfer::STATUS_NOT_PAID;
|
$sql .= " WHERE t.status = " . Transfer::STATUS_NOT_PAID;
|
||||||
|
|
||||||
//we can see all transfer in cart, or just our
|
//we can see all transfer in cart, or just our
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\db\Schema;
|
||||||
|
use yii\db\Migration;
|
||||||
|
|
||||||
|
class m160221_132448_alter__table__customer__add__column_mother_name__birth_place extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
$this->addColumn("customer", "mother_name", "string");
|
||||||
|
$this->addColumn("customer", "birth_place", "string");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
echo "m160221_132448_alter__table__customer__add__column_mother_name__birth_place cannot be reverted.\n";
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// Use safeUp/safeDown to run migration code within a transaction
|
||||||
|
public function safeUp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function safeDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@ -17,6 +17,8 @@ use common\components\Helper;
|
|||||||
use common\models\Sale;
|
use common\models\Sale;
|
||||||
use common\models\Product;
|
use common\models\Product;
|
||||||
use common\models\ShoppingCart;
|
use common\models\ShoppingCart;
|
||||||
|
use common\models\Customer;
|
||||||
|
use frontend\models\ContractForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContractController implements the CRUD actions for Contract model.
|
* ContractController implements the CRUD actions for Contract model.
|
||||||
@ -35,7 +37,7 @@ class ContractController extends Controller {
|
|||||||
],
|
],
|
||||||
'cancel' => [
|
'cancel' => [
|
||||||
'post'
|
'post'
|
||||||
],
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
@ -275,6 +277,61 @@ class ContractController extends Controller {
|
|||||||
'id' => $contract->id_contract
|
'id' => $contract->id_contract
|
||||||
] );
|
] );
|
||||||
}
|
}
|
||||||
|
public function actionMake($id) {
|
||||||
|
$customer = Customer::findOne ( $id );
|
||||||
|
|
||||||
|
if (! isset ( $customer )) {
|
||||||
|
throw new Exception ( "Az oldal nem található" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = new ContractForm ( [
|
||||||
|
'customer' => $customer
|
||||||
|
] );
|
||||||
|
$model->fillOut ();
|
||||||
|
|
||||||
|
if ($model->load ( Yii::$app->request->post () ) && $model->validate ()) {
|
||||||
|
|
||||||
|
$connection = \Yii::$app->db;
|
||||||
|
$transaction = $connection->beginTransaction ();
|
||||||
|
try {
|
||||||
|
|
||||||
|
$model->make ();
|
||||||
|
$transaction->commit();
|
||||||
|
return $this->redirect ( [
|
||||||
|
'contract/view',
|
||||||
|
'id' => $model->contract->id_contract
|
||||||
|
] );
|
||||||
|
} catch ( \Exception $e ) {
|
||||||
|
$transaction->rollBack();
|
||||||
|
\Yii::$app->session->setFlash('danger', $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render ( '_make_contract', [
|
||||||
|
'model' => $model
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
public function actionContract($id){
|
||||||
|
$model = $this->findModel($id);
|
||||||
|
|
||||||
|
//$mpdf=new \mPDF('utf-8', 'A4');
|
||||||
|
$mpdf=new \mPDF('utf-8','A4','','','15','15','26','18','3');
|
||||||
|
|
||||||
|
$mpdf->SetHTMLHeader("<div style='height: 80px; text-align: right; ' ><img height='80px' src='" . \Yii::getAlias("@webroot") . DIRECTORY_SEPARATOR. "images" . DIRECTORY_SEPARATOR . "cutler_contract_pdf_header.jpg'></div>");
|
||||||
|
$mpdf->setFooter('{PAGENO} / {nb}');
|
||||||
|
$mpdf->WriteHTML($this->renderPartial('_contract', [
|
||||||
|
'model' => $model,
|
||||||
|
]));
|
||||||
|
|
||||||
|
$fileName = "szerzodes";
|
||||||
|
$fileName .= "." . $model->customer->name;
|
||||||
|
$fileName .= "." .\Yii::$app->formatter->asDate( $model->created_at, "Y");
|
||||||
|
$fileName .=".pdf";
|
||||||
|
$mpdf->Output($fileName, 'D');//download file
|
||||||
|
// $mpdf->Output('szerzodes.pdf', 'I');//open in new tab
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Contract model based on its primary key value.
|
* Finds the Contract model based on its primary key value.
|
||||||
|
|||||||
@ -14,6 +14,8 @@ use common\models\Card;
|
|||||||
use frontend\models\CustomerUpdate;
|
use frontend\models\CustomerUpdate;
|
||||||
use frontend\models\CustomerCreate;
|
use frontend\models\CustomerCreate;
|
||||||
use common\models\Image;
|
use common\models\Image;
|
||||||
|
use frontend\models\ContractForm;
|
||||||
|
use yii\base\Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CustomerController implements the CRUD actions for Customer model.
|
* CustomerController implements the CRUD actions for Customer model.
|
||||||
@ -205,16 +207,13 @@ class CustomerController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function actionContract($id){
|
|
||||||
$model = $this->findModel($id);
|
|
||||||
|
|
||||||
$mpdf=new \mPDF('utf-8', 'A4-L');
|
|
||||||
$mpdf->WriteHTML($this->renderPartial('_contract', [
|
|
||||||
'model' => $model,
|
|
||||||
]));
|
|
||||||
$mpdf->Output('szerzodes.pdf', 'D');
|
|
||||||
exit;
|
// s
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an existing Customer model.
|
* Deletes an existing Customer model.
|
||||||
|
|||||||
@ -100,6 +100,9 @@ class KeyController extends Controller
|
|||||||
$model->toggleKey();
|
$model->toggleKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset($model->action ) && $model->action == 'unassign' ){
|
||||||
|
return $this->redirect(['product/sale', 'number' => $number ]);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->redirect(['customer/reception', 'number' => $number ]);
|
return $this->redirect(['customer/reception', 'number' => $number ]);
|
||||||
|
|
||||||
|
|||||||
@ -28,6 +28,8 @@ use frontend\components\DefaultAccountBehavior;
|
|||||||
use frontend\components\CassaOpenBehavior;
|
use frontend\components\CassaOpenBehavior;
|
||||||
use common\components\ProductInventory;
|
use common\components\ProductInventory;
|
||||||
use frontend\models\ProductInventorySearch;
|
use frontend\models\ProductInventorySearch;
|
||||||
|
use common\components\Helper;
|
||||||
|
use common\components\TransferPayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProductController implements the CRUD actions for Product model.
|
* ProductController implements the CRUD actions for Product model.
|
||||||
@ -63,16 +65,16 @@ class ProductController extends Controller {
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
// everything else is denied
|
// everything else is denied
|
||||||
|
|
||||||
] ,
|
|
||||||
// named behavior, configuration array
|
// named behavior, configuration array
|
||||||
'defaultAccount' => [
|
'defaultAccount' => [
|
||||||
'class' => DefaultAccountBehavior::className(),
|
'class' => DefaultAccountBehavior::className ()
|
||||||
],
|
],
|
||||||
'cassaIsOpen' => [
|
'cassaIsOpen' => [
|
||||||
'class' => CassaOpenBehavior::className(),
|
'class' => CassaOpenBehavior::className ()
|
||||||
],
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
public function actionSale($number = null) {
|
public function actionSale($number = null) {
|
||||||
@ -156,19 +158,6 @@ class ProductController extends Controller {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function actionPayoutUserCart() {
|
public function actionPayoutUserCart() {
|
||||||
if (Yii::$app->request->isAjax) {
|
|
||||||
// $result = [ ];
|
|
||||||
// \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
|
|
||||||
|
|
||||||
// $user = User::findOne ( Yii::$app->user->id );
|
|
||||||
// UserSoldItem::payout ( $user );
|
|
||||||
|
|
||||||
// $userTransfers = Transfer::modelsToArray ( Transfer::readUserSoldTransfers ( $user ) );
|
|
||||||
// $result ['transfers'] = $userTransfers;
|
|
||||||
// $result ['code'] = 'success';
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
} else {
|
|
||||||
$model = new UserCartPayoutForm ();
|
$model = new UserCartPayoutForm ();
|
||||||
$user = User::findOne ( Yii::$app->user->id );
|
$user = User::findOne ( Yii::$app->user->id );
|
||||||
|
|
||||||
@ -177,51 +166,39 @@ class ProductController extends Controller {
|
|||||||
$connection = \Yii::$app->db;
|
$connection = \Yii::$app->db;
|
||||||
$transaction = $connection->beginTransaction ();
|
$transaction = $connection->beginTransaction ();
|
||||||
try {
|
try {
|
||||||
UserSoldItem::payout ( $user, $model->transfers );
|
$tp = new TransferPayout ( [
|
||||||
|
'idUser' => \Yii::$app->user->id,
|
||||||
|
'idTransfers' => $model->transfers,
|
||||||
|
'cartType' => 'user',
|
||||||
|
'idAccount' => Account::readDefault ()
|
||||||
|
] );
|
||||||
|
|
||||||
|
$tp->payout ();
|
||||||
|
|
||||||
|
// UserSoldItem::payout ( $user, $model->transfers );
|
||||||
$transaction->commit ();
|
$transaction->commit ();
|
||||||
\Yii::$app->session->setFlash ( 'success', 'Recepicó kosár fizetve' );
|
\Yii::$app->session->setFlash ( 'success', 'Recepicó kosár fizetve' );
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
$transaction->rollback ();
|
$transaction->rollback ();
|
||||||
Yii::error ( "faled to save :" . $e->getMessage () );
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
|
} catch ( \Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Yii::error ( "faled to save : transfer" );
|
Yii::error ( "faled to save : transfer" );
|
||||||
\Yii::$app->session->setFlash ( 'warning', 'Nem történt változás' );
|
\Yii::$app->session->setFlash ( 'warning', 'Nem történt változás' );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $this->redirect ( Yii::$app->request->referrer );
|
return $this->redirect ( Yii::$app->request->referrer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function actionPayoutCustomerCart($number) {
|
public function actionPayoutCustomerCart($number) {
|
||||||
$cart = [ ];
|
$cart = [ ];
|
||||||
$code = 'error';
|
$code = 'error';
|
||||||
$message = 'Hiba történt';
|
$message = 'Hiba történt';
|
||||||
|
|
||||||
if (Yii::$app->request->isAjax) {
|
|
||||||
$result = [ ];
|
|
||||||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
|
|
||||||
|
|
||||||
$this->findByNumber ( $number );
|
|
||||||
|
|
||||||
if (isset ( $this->customer )) {
|
|
||||||
$connection = \Yii::$app->db;
|
|
||||||
$transaction = $connection->beginTransaction ();
|
|
||||||
try {
|
|
||||||
ShoppingCart::payout ( $this->customer );
|
|
||||||
$transaction->commit ();
|
|
||||||
$cart = Transfer::modelsToArray ( Transfer::readCustomerCart ( $this->customer ) );
|
|
||||||
$code = 'success';
|
|
||||||
$message = 'Bevásárlókosár fizetve: ' . $this->card->number;
|
|
||||||
} catch ( Exception $e ) {
|
|
||||||
$transaction->rollback ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$result ['customer_cart'] = $cart;
|
|
||||||
$result ['code'] = $code;
|
|
||||||
$result ['message'] = $message;
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
} else {
|
|
||||||
// post
|
// post
|
||||||
$model = new CustomerCartPayoutForm ();
|
$model = new CustomerCartPayoutForm ();
|
||||||
|
|
||||||
@ -233,24 +210,35 @@ class ProductController extends Controller {
|
|||||||
$connection = \Yii::$app->db;
|
$connection = \Yii::$app->db;
|
||||||
$transaction = $connection->beginTransaction ();
|
$transaction = $connection->beginTransaction ();
|
||||||
try {
|
try {
|
||||||
ShoppingCart::payout ( $this->customer, $model->transfers , Account::readDefault());
|
$tp = new TransferPayout ( [
|
||||||
|
'idUser' => \Yii::$app->user->id,
|
||||||
|
'idTransfers' => $model->transfers,
|
||||||
|
'cartType' => 'customer',
|
||||||
|
'idAccount' => Account::readDefault (),
|
||||||
|
'idCustomer' => $this->customer->id_customer
|
||||||
|
] );
|
||||||
|
|
||||||
|
$tp->payout ();
|
||||||
|
|
||||||
|
// UserSoldItem::payout ( $user, $model->transfers );
|
||||||
$transaction->commit ();
|
$transaction->commit ();
|
||||||
\Yii::$app->session->setFlash ( 'success', 'Vendég kosár kifizetve' );
|
\Yii::$app->session->setFlash ( 'success', 'Vendég kosár fizetve : ' . $this->customer->name );
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
$transaction->rollback ();
|
$transaction->rollback ();
|
||||||
Yii::error ( "faled to save :" . $e->getMessage () );
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
\Yii::$app->session->setFlash ( 'danger', 'Hiba történt a mentés során' );
|
} catch ( \Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Yii::error ( "faled to save : no customer or transfer" );
|
Yii::error ( "faled to save : no customer or transfer" );
|
||||||
\Yii::$app->session->setFlash ( 'warning', 'Nem történt változás' );
|
\Yii::$app->session->setFlash ( 'warning', 'Nem történt kifizetés' );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
\Yii::$app->session->setFlash ( 'warning', 'Nem történt változás' );
|
\Yii::$app->session->setFlash ( 'warning', 'Nem történt változás' );
|
||||||
}
|
}
|
||||||
return $this->redirect ( Yii::$app->request->referrer );
|
return $this->redirect ( Yii::$app->request->referrer );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@ -279,21 +267,14 @@ class ProductController extends Controller {
|
|||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function actionInventory() {
|
public function actionInventory() {
|
||||||
|
$searchModel = new ProductInventorySearch ( [
|
||||||
$searchModel = new ProductInventorySearch(
|
'account' => Account::readDefaultObject ()
|
||||||
['account' => Account::readDefaultObject()]
|
] );
|
||||||
);
|
|
||||||
|
|
||||||
// $searchModel->search(\Yii::$app->request->params);
|
// $searchModel->search(\Yii::$app->request->params);
|
||||||
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||||
|
|
||||||
|
|
||||||
// $inventory = new ProductInventory([
|
// $inventory = new ProductInventory([
|
||||||
// ]);
|
// ]);
|
||||||
// if ( $output == 'xls'){
|
// if ( $output == 'xls'){
|
||||||
@ -310,43 +291,34 @@ class ProductController extends Controller {
|
|||||||
|
|
||||||
$sheet = $objPHPExcel->setActiveSheetIndex ( 0 );
|
$sheet = $objPHPExcel->setActiveSheetIndex ( 0 );
|
||||||
/**
|
/**
|
||||||
*
|
* Termék azonosító Termék neve Termék szám Termék vonalkód Termék raktáron Termék eladva
|
||||||
Termék azonosító Termék neve Termék szám Termék vonalkód Termék raktáron Termék eladva
|
*/
|
||||||
* */
|
|
||||||
$row = 1;
|
$row = 1;
|
||||||
$sheet
|
$sheet->setCellValue ( 'A' . $row, "Termék azonosító" )->setCellValue ( 'B' . $row, "Termék név" )->setCellValue ( 'C' . $row, "Termék szám" )->setCellValue ( 'D' . $row, "Termék vonalkód" )->setCellValue ( 'E' . $row, "Termék raktáron" );
|
||||||
->setCellValue('A'.$row, "Termék azonosító")
|
|
||||||
->setCellValue('B'.$row, "Termék név")
|
|
||||||
->setCellValue('C'.$row, "Termék szám")
|
|
||||||
->setCellValue('D'.$row, "Termék vonalkód")
|
|
||||||
->setCellValue('E'.$row, "Termék raktáron");
|
|
||||||
// ->setCellValue('F'.$row, "Eladott mennyiség");
|
// ->setCellValue('F'.$row, "Eladott mennyiség");
|
||||||
|
|
||||||
foreach ( $models as $model ) {
|
foreach ( $models as $model ) {
|
||||||
$row ++;
|
$row ++;
|
||||||
$sheet->setCellValue('A'.$row, $model['product_id'])
|
$sheet->setCellValue ( 'A' . $row, $model ['product_id'] )->setCellValue ( 'B' . $row, $model ['product_name'] )->setCellValue ( 'C' . $row, $model ['product_number'] )->setCellValue ( 'D' . $row, $model ['product_barcode'] )->setCellValue ( 'E' . $row, $model ['product_stock'] );
|
||||||
->setCellValue('B'.$row, $model['product_name'])
|
|
||||||
->setCellValue('C'.$row, $model['product_number'])
|
|
||||||
->setCellValue('D'.$row, $model['product_barcode'])
|
|
||||||
->setCellValue('E'.$row, $model['product_stock']);
|
|
||||||
// ->setCellValue('F'.$row, $model['product_sold']);
|
// ->setCellValue('F'.$row, $model['product_sold']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$styleArray = array (
|
$styleArray = array (
|
||||||
'font' => array (
|
'font' => array (
|
||||||
'bold' => true,
|
'bold' => true
|
||||||
|
)
|
||||||
|
);
|
||||||
// 'color' => array('rgb' => 'FF0000'),
|
// 'color' => array('rgb' => 'FF0000'),
|
||||||
// 'size' => 15,
|
// 'size' => 15,
|
||||||
// 'name' => 'Verdana'
|
// 'name' => 'Verdana'
|
||||||
));
|
|
||||||
|
|
||||||
foreach(range('A','E') as $columnID)
|
|
||||||
{
|
|
||||||
|
foreach ( range ( 'A', 'E' ) as $columnID ) {
|
||||||
$sheet->getColumnDimension ( $columnID )->setAutoSize ( true );
|
$sheet->getColumnDimension ( $columnID )->setAutoSize ( true );
|
||||||
$sheet->getStyle ( $columnID . '1' )->applyFromArray ( $styleArray );
|
$sheet->getStyle ( $columnID . '1' )->applyFromArray ( $styleArray );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Redirect output to a client’s web browser (Excel5)
|
// Redirect output to a client’s web browser (Excel5)
|
||||||
header ( 'Content-Type: application/vnd.ms-excel' );
|
header ( 'Content-Type: application/vnd.ms-excel' );
|
||||||
header ( 'Content-Disposition: attachment;filename="leltar.xls"' );
|
header ( 'Content-Disposition: attachment;filename="leltar.xls"' );
|
||||||
@ -360,17 +332,15 @@ Termék azonosító Termék neve Termék szám Termék vonalkód Termék raktár
|
|||||||
header ( 'Pragma: public' ); // HTTP/1.0
|
header ( 'Pragma: public' ); // HTTP/1.0
|
||||||
$objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' );
|
$objWriter = \PHPExcel_IOFactory::createWriter ( $objPHPExcel, 'Excel5' );
|
||||||
$objWriter->save ( 'php://output' );
|
$objWriter->save ( 'php://output' );
|
||||||
exit;
|
exit ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->render ( 'inventory', [
|
||||||
|
'searchModel' => $searchModel,
|
||||||
return $this->render('inventory',[ 'searchModel' =>$searchModel, 'dataProvider' => $dataProvider]);
|
'dataProvider' => $dataProvider
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the Product model based on its primary key value.
|
* Finds the Product model based on its primary key value.
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
@ -399,8 +369,6 @@ Termék azonosító Termék neve Termék szám Termék vonalkód Termék raktár
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists all Product models.
|
* Lists all Product models.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -23,6 +23,9 @@ use frontend\models\UserCartForm;
|
|||||||
use common\models\Customer;
|
use common\models\Customer;
|
||||||
use frontend\models\CustomerCartForm;
|
use frontend\models\CustomerCartForm;
|
||||||
use common\models\Card;
|
use common\models\Card;
|
||||||
|
use common\components\Helper;
|
||||||
|
use yii\base\Exception;
|
||||||
|
use common\components\TransferPayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TransferController implements the CRUD actions for Transfer model.
|
* TransferController implements the CRUD actions for Transfer model.
|
||||||
@ -190,26 +193,27 @@ class TransferController extends Controller
|
|||||||
$transfer = $this->findModel($id);
|
$transfer = $this->findModel($id);
|
||||||
$connection = \Yii::$app->db;
|
$connection = \Yii::$app->db;
|
||||||
$transaction = $connection->beginTransaction();
|
$transaction = $connection->beginTransaction();
|
||||||
try {
|
|
||||||
$transfer->status = Transfer::STATUS_PAID;
|
|
||||||
$transfer->paid_at = date('Y-m-d H:i:s' ) ;
|
|
||||||
$transfer->paid_by = \Yii::$app->user->id;
|
|
||||||
$transfer->id_account = Account::readDefault();
|
|
||||||
ShoppingCart::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
|
|
||||||
UserSoldItem::deleteAll([ 'id_transfer' => $transfer->id_transfer]);
|
|
||||||
if ( $transfer->save() ){
|
|
||||||
\Yii::$app->session->setFlash( 'success','Tranzakció kifizetve!' );
|
|
||||||
$transaction->commit();
|
|
||||||
}else{
|
|
||||||
throw new \Exception("Failed to save");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
$tp = new TransferPayout( [
|
||||||
|
'idUser' => \Yii::$app->user->id,
|
||||||
|
'idTransfers' => [$transfer->id_transfer ],
|
||||||
|
'idAccount' => Account::readDefault (),
|
||||||
|
] );
|
||||||
|
|
||||||
|
$tp->payout ();
|
||||||
|
|
||||||
|
// UserSoldItem::payout ( $user, $model->transfers );
|
||||||
|
$transaction->commit ();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', 'Tranzakció fizetve: ' . $transfer->count ." db " . $transfer->getObjectName() . " - " . $transfer->money);
|
||||||
} catch ( Exception $e ) {
|
} catch ( Exception $e ) {
|
||||||
$transaction->rollback ();
|
$transaction->rollback ();
|
||||||
\Yii::$app->session->setFlash( 'danger','Tranzakció kifizetése nem sikerült' );
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
|
} catch ( \Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->redirect(Yii::$app->request->referrer);
|
return $this->redirect(Yii::$app->request->referrer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,6 +363,8 @@ class TransferController extends Controller
|
|||||||
$model->run();
|
$model->run();
|
||||||
return $this->render("usercart",[ 'model' => $model]);
|
return $this->render("usercart",[ 'model' => $model]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function actionCustomerCart($id_card){
|
public function actionCustomerCart($id_card){
|
||||||
|
|
||||||
$defaultAccount = Account::readDefault();
|
$defaultAccount = Account::readDefault();
|
||||||
|
|||||||
@ -56,4 +56,7 @@ class ContactForm extends Model
|
|||||||
->setTextBody($this->body)
|
->setTextBody($this->body)
|
||||||
->send();
|
->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
313
frontend/models/ContractForm.php
Normal file
313
frontend/models/ContractForm.php
Normal file
@ -0,0 +1,313 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace frontend\models;
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\base\Model;
|
||||||
|
use yii\base\Exception;
|
||||||
|
use common\models\Ticket;
|
||||||
|
use common\models\Account;
|
||||||
|
use common\models\TicketType;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use common\models\Contract;
|
||||||
|
use common\models\TicketInstallmentRequest;
|
||||||
|
use common\models\Discount;
|
||||||
|
use common\models\ShoppingCart;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContactForm is the model behind the contact form.
|
||||||
|
*/
|
||||||
|
class ContractForm extends Model {
|
||||||
|
public $name;
|
||||||
|
public $birthdate;
|
||||||
|
public $birthplace;
|
||||||
|
public $mothername;
|
||||||
|
public $zip;
|
||||||
|
public $city;
|
||||||
|
public $address;
|
||||||
|
public $bank_account;
|
||||||
|
public $bank_name;
|
||||||
|
public $phone;
|
||||||
|
public $email;
|
||||||
|
public $ticket_type;
|
||||||
|
public $customer;
|
||||||
|
public $payment_method;
|
||||||
|
public $id_discount;
|
||||||
|
private $ticket;
|
||||||
|
private $transfer;
|
||||||
|
public $contract;
|
||||||
|
private $ticketType;
|
||||||
|
private $money;
|
||||||
|
private $discount;
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function rules() {
|
||||||
|
return [
|
||||||
|
// name, email, subject and body are required
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'ticket_type',
|
||||||
|
'name',
|
||||||
|
'birthdate',
|
||||||
|
'birthplace',
|
||||||
|
'mothername',
|
||||||
|
"zip",
|
||||||
|
"city",
|
||||||
|
"address",
|
||||||
|
"bank_account",
|
||||||
|
"bank_name",
|
||||||
|
'phone',
|
||||||
|
'email',
|
||||||
|
'payment_method'
|
||||||
|
],
|
||||||
|
'required'
|
||||||
|
],
|
||||||
|
// email has to be a valid email address
|
||||||
|
[
|
||||||
|
'email',
|
||||||
|
'email'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'ticket_type',
|
||||||
|
'integer'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'phone'
|
||||||
|
],
|
||||||
|
'string',
|
||||||
|
'max' => 20
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'bank_account'
|
||||||
|
],
|
||||||
|
'string',
|
||||||
|
'max' => 24
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'bank_name'
|
||||||
|
],
|
||||||
|
'string',
|
||||||
|
'max' => 100
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'mothername',
|
||||||
|
'birthplace',
|
||||||
|
'name',
|
||||||
|
'zip',
|
||||||
|
'city',
|
||||||
|
'address'
|
||||||
|
],
|
||||||
|
'string',
|
||||||
|
'max' => 100
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'birthdate'
|
||||||
|
],
|
||||||
|
'date'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'ticket_type',
|
||||||
|
'id_discount',
|
||||||
|
'payment_method'
|
||||||
|
],
|
||||||
|
'integer'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'ticket_type'
|
||||||
|
],
|
||||||
|
'validateTicketType'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
public function validateTicketType($attribute, $params) {
|
||||||
|
$this->ticketType = TicketType::findOne ( $this->ticket_type );
|
||||||
|
if (! isset ( $this->ticketType )) {
|
||||||
|
$this->addError ( $attribute, "Bérlet típus nem található" );
|
||||||
|
}else{
|
||||||
|
$contracts = Contract::find()->andWhere(['>' ,'contract.expired_at', date('Y-m-d')])->andWhere(['not in' ,'contract.flag',[Contract::$FLAG_DELETED]])->all();
|
||||||
|
if ( count($contracts) > 0 ){
|
||||||
|
$this->addError( $attribute , "Már van érvényes vagy lemondott szerződés az adott időszakban");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
public function attributeLabels() {
|
||||||
|
return [
|
||||||
|
'name' => 'Név',
|
||||||
|
'birthdate' => 'Születési dátum',
|
||||||
|
'birthplace' => 'Születési hely',
|
||||||
|
'mothername' => 'Anyja neve',
|
||||||
|
'zip' => 'Irányítószám',
|
||||||
|
'city' => 'Város',
|
||||||
|
'address' => 'Cím',
|
||||||
|
'bank_account' => 'Bankszámlaszám',
|
||||||
|
'bank_name' => 'Bank neve',
|
||||||
|
'phone' => 'Telefonszám',
|
||||||
|
'email' => 'E-mail',
|
||||||
|
'ticket_type' => 'Bérlet típus' ,
|
||||||
|
'payment_method' => 'Fizetési mód' ,
|
||||||
|
'id_discount' => 'Kedvezmény' ,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
public function fillOut() {
|
||||||
|
$this->name = $this->customer->name;
|
||||||
|
$this->birthdate = isset ( $this->customer->birthdate ) ? \Yii::$app->formatter->asDate ( $this->customer->birthdate ) : '';
|
||||||
|
$this->birthplace = $this->customer->birth_place;
|
||||||
|
$this->mothername = $this->customer->mother_name;
|
||||||
|
$this->zip = $this->customer->zip;
|
||||||
|
$this->city = $this->customer->city;
|
||||||
|
$this->address = $this->customer->address;
|
||||||
|
$this->bank_account = $this->customer->bank_account;
|
||||||
|
$this->bank_name = $this->customer->bank_name;
|
||||||
|
$this->phone = $this->customer->phone;
|
||||||
|
$this->email = $this->customer->email;
|
||||||
|
}
|
||||||
|
public function make() {
|
||||||
|
$this->money = $this->ticketType->price_brutto;
|
||||||
|
$this->discount = Discount::findOne($this->id_discount);
|
||||||
|
if ( isset($this->discount)){
|
||||||
|
$this->money = Discount::applyDiscount($this->ticketType->price_brutto, $this->discount);
|
||||||
|
}
|
||||||
|
$this->updateCustomer ();
|
||||||
|
|
||||||
|
|
||||||
|
$this->createTicket ();
|
||||||
|
$this->createTransfer ();
|
||||||
|
$this->appendToCustomerCart();
|
||||||
|
$this->addContract();
|
||||||
|
|
||||||
|
$this->ticket->id_contract = $this->contract->id_contract;
|
||||||
|
|
||||||
|
if ( !$this->ticket->update(false)){
|
||||||
|
\Yii::error("Nem sikerült a bérlethez hozzárendelni a szerződést");
|
||||||
|
throw new Exception("Hiba történt mentés közben!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
public function updateCustomer() {
|
||||||
|
$this->customer->name = $this->name;
|
||||||
|
$this->customer->birthdate = $this->birthdate;
|
||||||
|
$this->customer->birth_place = $this->birthplace;
|
||||||
|
$this->customer->mother_name = $this->mothername;
|
||||||
|
$this->customer->zip = $this->zip;
|
||||||
|
$this->customer->city = $this->city;
|
||||||
|
$this->customer->address = $this->address;
|
||||||
|
$this->customer->bank_account = $this->bank_account;
|
||||||
|
$this->customer->bank_name = $this->bank_name;
|
||||||
|
$this->customer->phone = $this->phone;
|
||||||
|
$this->customer->email = $this->email;
|
||||||
|
|
||||||
|
if (! $this->customer->save ( false )) {
|
||||||
|
throw new Exception ( 'nem sikerült a szerződés létrehozása' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public function createTicket() {
|
||||||
|
|
||||||
|
$ticket = new Ticket ();
|
||||||
|
$ticket->id_user = \Yii::$app->user->id;
|
||||||
|
$ticket->id_account = Account::readDefault ();
|
||||||
|
$ticket->id_discount = $this->id_discount;
|
||||||
|
$ticket->start = date ( 'Y-m-d' );
|
||||||
|
$date = new \DateTime ();
|
||||||
|
$date->modify ( '+1 month' );
|
||||||
|
$date->modify ( '-1 day' );
|
||||||
|
$ticket->end = $date->format ( 'Y-m-d H:i:s' );
|
||||||
|
$ticket->id_ticket_type = $this->ticketType->id_ticket_type;
|
||||||
|
$ticket->price_brutto = $this->money;
|
||||||
|
$ticket->max_usage_count = $this->ticketType->max_usage_count;
|
||||||
|
$ticket->usage_count = 0;
|
||||||
|
$ticket->status = Ticket::STATUS_ACTIVE;
|
||||||
|
$ticket->comment = "Szerződéses bérlet";
|
||||||
|
$ticket->id_card = $this->customer->card->id_card;
|
||||||
|
$ticket->part = 0;
|
||||||
|
$ticket->part_paid = 0;
|
||||||
|
$ticket->part_count = $this->ticketType->installment_count;
|
||||||
|
|
||||||
|
if (! $ticket->save ( false )) {
|
||||||
|
\Yii::error ( "A bérlet mentése sikertelen volt" );
|
||||||
|
throw new Exception ( "Hiba történt mentés közben" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->ticket = $ticket;
|
||||||
|
}
|
||||||
|
public function createTransfer() {
|
||||||
|
$transfer = new Transfer ();
|
||||||
|
$transfer->id_object = $this->ticket->id_ticket;
|
||||||
|
$transfer->status = Transfer::STATUS_NOT_PAID;
|
||||||
|
$transfer->type = Transfer::TYPE_TICKET;
|
||||||
|
$transfer->item_price = $this->money;
|
||||||
|
$transfer->count = 1;
|
||||||
|
$transfer->money = $this->money;
|
||||||
|
$transfer->id_user = \Yii::$app->user->id;
|
||||||
|
$transfer->comment = "Szerződéses bérlet";
|
||||||
|
$transfer->id_account = Account::readDefault ();
|
||||||
|
$transfer->direction = Transfer::DIRECTION_IN;
|
||||||
|
$transfer->id_customer = $this->customer->id_customer;
|
||||||
|
$transfer->payment_method = $this->payment_method;
|
||||||
|
$transfer->id_discount = $this->id_discount;
|
||||||
|
|
||||||
|
if (! $transfer->save ( false )) {
|
||||||
|
\Yii::error ( "A tranzakció mentése sikertelen volt" );
|
||||||
|
throw new Exception ( "Hiba történt mentés közben" );
|
||||||
|
}
|
||||||
|
$this->transfer = $transfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addContract() {
|
||||||
|
if (! $this->ticketType->isInstallment ()) {
|
||||||
|
\Yii::error ( "A bérlet típus nem tágmogatja a szerződés kötést!" );
|
||||||
|
throw new Exception ( "A bérlet típus nem tágmogatja a szerződés kötést!" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$contract = new Contract ();
|
||||||
|
$contract->id_customer = $this->customer->id_customer;
|
||||||
|
$contract->id_user = \Yii::$app->user->id;
|
||||||
|
$contract->status = Contract::$STATUS_PAID;
|
||||||
|
$contract->flag = Contract::$FLAG_ACTIVE;
|
||||||
|
$contract->part_count = $this->ticketType->installment_count;
|
||||||
|
$contract->part_paid = 0;
|
||||||
|
$contract->part_required = 0;
|
||||||
|
$contract->expired_at = date ( 'Y-m-d', strtotime ( "today +12 month -1 day" ) );
|
||||||
|
$contract->id_ticket_type = $this->ticketType->id_ticket_type;
|
||||||
|
|
||||||
|
if (! $contract->save ( false )) {
|
||||||
|
\Yii::error ( "A szerződés mentése sikertelen volt" );
|
||||||
|
throw new Exception ( "Hiba történt mentés közben" );
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->contract = $contract;
|
||||||
|
|
||||||
|
$requests = TicketInstallmentRequest::createInstallments ( $this->ticket, $this->ticketType, $this->customer, $contract );
|
||||||
|
foreach ( $requests as $request ) {
|
||||||
|
$request->save ( false );
|
||||||
|
if (! $request->save ( false )) {
|
||||||
|
\Yii::error ( "A szerződés részlet mentése sikertelen volt" );
|
||||||
|
throw new Exception ( "Hiba történt mentés közben" );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function appendToCustomerCart(){
|
||||||
|
$item = new ShoppingCart();
|
||||||
|
$item->id_customer = $this->customer->id_customer;
|
||||||
|
$item->id_transfer = $this->transfer->id_transfer;
|
||||||
|
if ( !$item->save(false) ){
|
||||||
|
\Yii::error("Vendég kosár hozzárendelés sikertelen!");
|
||||||
|
throw new Exception ( "Hiba történt mentés közben" );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,7 @@ use Yii;
|
|||||||
use yii\base\Model;
|
use yii\base\Model;
|
||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
use common\components\TransferPayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContactForm is the model behind the contact form.
|
* ContactForm is the model behind the contact form.
|
||||||
@ -60,19 +61,34 @@ class CustomerCartForm extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($this->selected) && count($this->selected) > 0 ){
|
if ( isset($this->selected) && count($this->selected) > 0 ){
|
||||||
$items = $this->loadTransfers($this->selected);
|
|
||||||
if ( count($items) == count($this->selected) ){
|
$connection = \Yii::$app->db;
|
||||||
foreach ($items as $item){
|
$transaction = $connection->beginTransaction();
|
||||||
$this->changePaymentMethod($item);
|
try {
|
||||||
$item->id_account = Account::readDefault();
|
$tp = new TransferPayout( [
|
||||||
$item->payout();
|
'idUser' => \Yii::$app->user->id,
|
||||||
}
|
'idTransfers' => $this->selected,
|
||||||
\Yii::$app->session->setFlash('success', 'Kifizetve');
|
'idAccount' => Account::readDefault (),
|
||||||
|
'cartType' => 'customer',
|
||||||
|
'overridePaymentMethod' => $this->payment_method,
|
||||||
|
'idCustomer' => $this->customer->id_customer
|
||||||
|
] );
|
||||||
|
|
||||||
|
$tp->payout ();
|
||||||
|
|
||||||
|
$transaction->commit ();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', 'A vásárló kosár kiválasztott tranzakciói ki lettek kifizetve!');
|
||||||
return true;
|
return true;
|
||||||
}else{
|
|
||||||
\Yii::$app->session->setFlash('danger', 'Időközben változtak a kosrában található tételek');
|
} catch ( Exception $e ) {
|
||||||
return false;
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
|
} catch ( \Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
\Yii::$app->session->setFlash('danger', 'Nem választott ki terméket');
|
\Yii::$app->session->setFlash('danger', 'Nem választott ki terméket');
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -105,7 +105,9 @@ class CustomerCreate extends \common\models\Customer
|
|||||||
[['zip'], 'string', 'max' => 8],
|
[['zip'], 'string', 'max' => 8],
|
||||||
|
|
||||||
[['city'], 'string', 'max' => 30],
|
[['city'], 'string', 'max' => 30],
|
||||||
[['photo_data'] ,'safe']
|
[['photo_data'] ,'safe'],
|
||||||
|
[['birth_place'] ,'safe'],
|
||||||
|
[['mother_name'] ,'safe'],
|
||||||
|
|
||||||
// [['email','phone'], 'validateEmailOrPhoneRequired' ],
|
// [['email','phone'], 'validateEmailOrPhoneRequired' ],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -115,7 +115,9 @@ class CustomerUpdate extends \common\models\Customer
|
|||||||
[['zip'], 'string', 'max' => 8],
|
[['zip'], 'string', 'max' => 8],
|
||||||
|
|
||||||
[['city'], 'string', 'max' => 30],
|
[['city'], 'string', 'max' => 30],
|
||||||
[['photo_data'] ,'safe']
|
[['photo_data'] ,'safe'],
|
||||||
|
[['birth_place'] ,'safe'],
|
||||||
|
[['mother_name'] ,'safe'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,7 @@ class KeyToggleForm extends Model
|
|||||||
public $card;
|
public $card;
|
||||||
public $customer;
|
public $customer;
|
||||||
public $keyModel;
|
public $keyModel;
|
||||||
|
public $action;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -55,6 +55,7 @@ class KeyToggleForm extends Model
|
|||||||
$assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all();
|
$assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all();
|
||||||
if ( count($assignments) > 0){
|
if ( count($assignments) > 0){
|
||||||
$this->unassign();
|
$this->unassign();
|
||||||
|
$this->action = 'unassign';
|
||||||
}else{
|
}else{
|
||||||
$this->assign();
|
$this->assign();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ use yii\base\Model;
|
|||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
use common\components\Helper;
|
use common\components\Helper;
|
||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
|
use common\components\TransferPayout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ContactForm is the model behind the contact form.
|
* ContactForm is the model behind the contact form.
|
||||||
@ -60,19 +61,48 @@ class UserCartForm extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($this->selected) && count($this->selected) > 0 ){
|
if ( isset($this->selected) && count($this->selected) > 0 ){
|
||||||
$items = $this->loadTransfers($this->selected);
|
|
||||||
if ( count($items) == count($this->selected) ){
|
$connection = \Yii::$app->db;
|
||||||
foreach ($items as $item){
|
$transaction = $connection->beginTransaction();
|
||||||
$this->changePaymentMethod($item);
|
try {
|
||||||
$item->id_account = Account::readDefault();
|
$tp = new TransferPayout( [
|
||||||
$item->payout();
|
'idUser' => \Yii::$app->user->id,
|
||||||
}
|
'idTransfers' => $this->selected,
|
||||||
\Yii::$app->session->setFlash('success', 'Kifizetve');
|
'idAccount' => Account::readDefault (),
|
||||||
|
'cartType' => 'user',
|
||||||
|
'overridePaymentMethod' => $this->payment_method
|
||||||
|
] );
|
||||||
|
|
||||||
|
$tp->payout ();
|
||||||
|
|
||||||
|
$transaction->commit ();
|
||||||
|
\Yii::$app->session->setFlash ( 'success', 'A recepció kosár kiválasztott tranzakciói ki lettek kifizetve!');
|
||||||
return true;
|
return true;
|
||||||
}else{
|
|
||||||
\Yii::$app->session->setFlash('danger', 'Időközben változtak a kosrában található tételek');
|
} catch ( Exception $e ) {
|
||||||
return false;
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
|
} catch ( \Exception $e ) {
|
||||||
|
$transaction->rollback ();
|
||||||
|
Yii::error ( "faled to save :" . $e->getMessage () );
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// $items = $this->loadTransfers($this->selected);
|
||||||
|
// if ( count($items) == count($this->selected) ){
|
||||||
|
// foreach ($items as $item){
|
||||||
|
// $this->changePaymentMethod($item);
|
||||||
|
// if ( Helper::isUserCartVisibilityAll() ){
|
||||||
|
// $item->id_account = Account::readDefault();
|
||||||
|
// }
|
||||||
|
// $item->payout();
|
||||||
|
// }
|
||||||
|
// \Yii::$app->session->setFlash('success', 'Kifizetve');
|
||||||
|
// return true;
|
||||||
|
// }else{
|
||||||
|
// \Yii::$app->session->setFlash('danger', 'Időközben változtak a kosrában található tételek');
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
}else{
|
}else{
|
||||||
\Yii::$app->session->setFlash('danger', 'Nem választott ki terméket');
|
\Yii::$app->session->setFlash('danger', 'Nem választott ki terméket');
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -55,18 +55,6 @@ $card = $model->card;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php
|
|
||||||
if ( $model->isCustomerWithTicket() ){
|
|
||||||
?>
|
|
||||||
<div class='row'>
|
|
||||||
<div class='col-md-12'>
|
|
||||||
<?php echo Html::a( "Éves szerződés letöltése", [ 'customer/contract' , 'id' => $model->customer->id_customer ]);?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-12'>
|
<div class='col-md-12'>
|
||||||
|
|||||||
295
frontend/views/contract/_contract.php
Normal file
295
frontend/views/contract/_contract.php
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
<?php
|
||||||
|
use common\components\Azaz;
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$customer = $model->customer;
|
||||||
|
|
||||||
|
$customerName = $customer->name;
|
||||||
|
$customerAddress = $customer->getFullAddress();
|
||||||
|
$customerBirthInfo = $customer->birth_place . ", " . ( isset( $customer->birthdate ) ? \Yii::$app->formatter->asDate($customer->birthdate) : '');
|
||||||
|
$customerMotherName = $customer->mother_name;
|
||||||
|
$customerPhone = $customer->phone;
|
||||||
|
$customerEmail = $customer->email;
|
||||||
|
$customerBankAccount = $customer->bank_account;
|
||||||
|
$customerIdCustomer = $customer->id_customer;
|
||||||
|
|
||||||
|
$contractDate = date('Y.m.d');
|
||||||
|
|
||||||
|
$azaz = new Azaz();
|
||||||
|
$ticketMoneyYear = $model->getPriceTotal();
|
||||||
|
$ticketMoneyYearText = $azaz->toString($ticketMoneyYear);
|
||||||
|
|
||||||
|
$ticketMoneyMonth = $model->getPriceMonthly();
|
||||||
|
$ticketMoneyMonthText = $azaz->toString($ticketMoneyMonth);
|
||||||
|
|
||||||
|
$customerBankName = $customer->bank_name;
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h1 style='text-align: center'>
|
||||||
|
TAGSÁGI SZERZŐDÉS
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Mely létrejött egyrészről:
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>
|
||||||
|
<b>Cutler-Four Kereskedelmi és Szolgáltató Korlátolt Felelősségű Társaság</b>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
székhely: 9222 Hegyeshalom, Pozsonyi u. 11.
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
adószám: 25006285-2-08
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
cégjegyzékszám: 08-09-026601
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
bankszámlaszám: 59500155-11109938
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
képviseli: Freimann Sándor ügyvezető
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
(a továbbiakban, mint Szolgáltató),
|
||||||
|
</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
másrészről:
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>
|
||||||
|
név: <?php echo $customerName ?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
lakcím: <?php echo $customerAddress?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
születési hely, idő: <?php echo $customerBirthInfo ?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
anyja neve: <?php echo $customerMotherName?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
telefonszám: <?php echo $customerPhone;?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
e-mail cím: <?php echo $customerEmail?>
|
||||||
|
</td></tr>
|
||||||
|
<tr><td>
|
||||||
|
bankszámlaszám: <?php echo $customerBankAccount; ?>
|
||||||
|
</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
(a továbbiakban, mint Tag) között alulírott helyen és időben az alábbi feltételekkel.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<ol style="text-align: justify;">
|
||||||
|
<li>
|
||||||
|
A szerződő felek rögzítik, hogy a Tag igénybe kívánja venni a 9027 Győr, Nagysándor József utca 31. szám alatti CUTLER FITNESS Győr edzőterem szolgáltatásait az alábbiakban részletezett feltételek alapján.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
A szerződő felek rögzítik, hogy jelen megállapodást 12 hónap határozott időtartamra kötik, melynek kezdő időpontja a jelen szerződés aláírásának a napja.
|
||||||
|
<p>
|
||||||
|
Felek megállapodnak abban is, hogy a jelen szerződés automatikusan további újabb és újabb 12 hónappal ráutaló magatartással meghosszabbodik mindaddig, ameddig bármelyik fél a szerződés, illetve a meghosszabbodott szerződés lejártát megelőző 30 napon belül a másik fél részére írásban a szerződés megszűntetésére vonatkozó szándékát nem közli.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
A Szerződő Felek kijelentik, hogy a Tag a határozott időtartamú szerződés hatálya alatt, a CUTLER FITNESS Győr szolgáltatásait kedvezményesen veheti igénybe. Ezen kedvezményes éves tagsági díj összege <?php echo $ticketMoneyYear?> Ft, azaz <?php echo $ticketMoneyYearText?> forint, amely havi részletekben fizetendő meg. Így a havonta fizetendő tagsági díj összege havi <?php echo $ticketMoneyMonth?> Ft, azaz <?php echo $ticketMoneyMonthText?> forint, melynek első részletét a Tag jelen szerződés aláírásakor köteles megfizetni. Az első részlet megfizetéséig a Tag nem jogosult a szolgáltatások igénybe vételére.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
A további részletek előre, a jelen szerződésmegkötését követő 30 naponta esedékesek. Ezen összegeket a Szolgáltató a Tag bankszámlájáról történő leemeléssel, úgy nevezett csoportos beszedési megbízással szedi be a Tag jelen szerződéssel egyidejűleg adott, aláírt felhatalmazása alapján.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Tag tudomásul veszi, hogy a Szolgáltató a bankszámláról történő beszedést az esedékességet megelőző 15 napon belül jogosult elindítani. Tag köteles a bankszámláján legalább a levonandó összegnek megfelelő egyenleget tartani, hogy a beszedés megtörténhessen.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Amennyiben a Szolgáltató részére az adott hónapban nem teljesül a bankszámláról történő beszedés, úgy azt Szolgáltató nem ismétli meg (aktuális időszakra). Amennyiben a Tag továbbra is igénybe kívánja venni a Szolgáltató szolgáltatását a díjfizetéssel nem rendezett időszakban, úgy köteles a hátralék egyéb úton történő megfizetésére.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Tag tudomásul veszi, hogy a Szolgáltató a szolgáltatási díjjal nem rendezett időszak alatt az elmaradás rendezéséig, az igénybe vehető szolgáltatások körét részben vagy egészben korlátozhatja, a Szolgáltató a belépést a területére megtilthatja.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Amennyiben Szolgáltató legalább 3 egymást követő hónapban sem tudja beszedni a bérlet összegét a bankszámlára indított csoportos beszedéssel, úgy Szolgáltató jogosult jelen Szerződés azonnali hatályú felmondására.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
A Tag kijelenti, hogy a Szolgáltató recepciójánál kifüggesztett Házirendjét és jelen szerződést elolvasta, értelmezte és azt magára nézve kötelezőnek ismerte el.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Felmondási lehetőségek
|
||||||
|
<ol type="lower-alpha">
|
||||||
|
<li>
|
||||||
|
A Tag tudomásul veszi, hogy a határozott időtartam alatt nincs lehetőség a tagsági jogviszony felmondására. Indokolt esetben (pl. terhesség, sérülés, távoli helyre költözés, stb.) a Tag írásban kezdeményezheti a Szerződés közös megegyezéssel történő megszűntetését, amely kérelemről a Szolgáltató 15 napon belül saját belátása szerint dönt és döntéséről a kérelmezőt értesíti.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Jelen szerződés azonnali hatályú felmondására jogosult a Szolgáltató, amennyiben a Tag a bankszámlájára vonatkozó csoportos beszedési megbízásra vonatkozó felhatalmazást visszavonja a bankjánál, a bankszámláját megszünteti vagy a Házirendet súlyosan megszegi.
|
||||||
|
<p><b>
|
||||||
|
Ha Szolgáltató bármelyik fenti ok kapcsán él az azonnali hatályú felmondásra vonatkozó jogával, akkor a Tag köteles a szerződéséből hátralévő határozott időtartam alapulvételével havi 3.000,- Ft, azaz Háromezer forint kötbér megfizetésére, továbbá a felmondást követő 1 éven belül nem lesz jogosult újabb éves szerződés megkötésére.
|
||||||
|
</b></p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Szolgáltató bármikor egyoldalúan jogosult arra, hogy a jelen Szerződést 30 napos felmondási idővel írásban felmondja, amennyiben a Tag a Házirendet bizonyíthatóan megsérti.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Jelen szerződésben nem szabályozott kérdésekben a Ptk. rendelkezései az irányadóak.
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Kelt: Győr, <?php echo $contractDate ?>
|
||||||
|
</p>
|
||||||
|
<table style="width: 100%; margin-top: 30px;">
|
||||||
|
<tr>
|
||||||
|
<td style="width: 33%">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td style="width: 33%; border-bottom: 1px dotted #000;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
Szolgáltató
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
Tag
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
Cutler-FourKft.
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<?php echo $customerName?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
Freimann Sándor ügyvezető
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<pagebreak />
|
||||||
|
|
||||||
|
<h2>Felhatalmazás csoportos beszedési megbízás teljesítésére</h2>
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
Fizető fél adatai:
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Fizető fél neve: <?php echo $customerName?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Fizető fél bankszámlaszáma: <?php echo $customerBankAccount?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
Kedvezményezett adatai:
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Kedvezményezett neve: <b>CUTLER-FOUR Kereskedelmi és Szolgáltató Kft.</b>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Kedvezményezett azonosítója: <b>A25006285</b>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
Kedvezményezettel szerződéses viszonyban lévő személy adatai:
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Szerződő fél neve: <?php echo $customerName?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Szerződő fél címe: <?php echo $customerAddress?>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Szerződő fél azonosítója a Kedvezményezettnél: <?php echo $customerIdCustomer?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
Teljesítés adatai:
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Érvényesség kezdete: <?php echo $contractDate?> lejárata:
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
Teljesítés felső értékhatára:
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div>
|
||||||
|
Felhatalmazás jellege: eredeti felhatalmazás
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Nyilatkozat
|
||||||
|
<p style="text-align: justify;">
|
||||||
|
Jelen nyomtatvány kitöltésével és aláírásával felhatalmazom <?php echo $customerBankName?> pénzforgalmi szolgáltatót arra, hogy a fentebb megjelölt Kedvezményezettet az általam benyújtott felhatalmazásról értesítse, és fizetési számlámat a Kedvezményezett által benyújtott beszedési megbízás alapján – megbízásom keretei között – megterhelje. Tudomásul veszem, hogy a beszedési megbízás teljesítésére szóló felhatalmazás elfogadásáról, a beszedés megkezdésének tényleges időpontjáról, illetve az elutasításáról és annak okáról a Kedvezményezettől a számlavezetőm és a szerződő fél értesítést kap.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<table style="width: 100%; margin-top: 30px;">
|
||||||
|
<tr>
|
||||||
|
<td style="width: 33%; ">
|
||||||
|
Kelt: Győr, <?php echo $contractDate ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td style="width: 33%; ">
|
||||||
|
Kelt: Győr, <?php echo $contractDate ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
<table style="width: 100%; margin-top: 30px;">
|
||||||
|
<tr>
|
||||||
|
<td style="width: 33%; border-bottom: 1px dotted #000;">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td style="width: 33%; border-bottom: 1px dotted #000;">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
Fizető fél aláírása
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: center;">
|
||||||
|
Átvevő aláírása
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
119
frontend/views/contract/_make_contract.php
Normal file
119
frontend/views/contract/_make_contract.php
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use yii\helpers\Html;
|
||||||
|
use yii\widgets\ActiveForm;
|
||||||
|
use common\models\TicketType;
|
||||||
|
use common\components\Helper;
|
||||||
|
use frontend\components\HtmlHelper;
|
||||||
|
use kartik\widgets\DatePicker;
|
||||||
|
use common\models\Transfer;
|
||||||
|
use common\models\Discount;
|
||||||
|
|
||||||
|
/* @var $this yii\web\View */
|
||||||
|
/* @var $model common\models\Contract */
|
||||||
|
/* @var $form yii\widgets\ActiveForm */
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$types = TicketType::findAll(['status' => TicketType::STATUS_ACTIVE ,'installment_enabled' => '1']);
|
||||||
|
$types = HtmlHelper::mkTicketTypeOptions($types);
|
||||||
|
|
||||||
|
$discounts = Discount::read();
|
||||||
|
$discounts = ['' => ''] + HtmlHelper::mkDiscountOptions($discounts);
|
||||||
|
|
||||||
|
?>
|
||||||
|
<h1>Szerződés létrehozása</h1>
|
||||||
|
<div class="contract-form">
|
||||||
|
|
||||||
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'name')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'mothername')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
|
||||||
|
'pluginOptions' => [
|
||||||
|
'autoclose'=>true,
|
||||||
|
'format' => 'yyyy.mm.dd'
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'birthplace')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'zip')->textInput() ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
<?= $form->field($model, 'city')->textInput() ?>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
<?= $form->field($model, 'address')->textInput() ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'bank_name')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'bank_account')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'phone')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'email')->textInput() ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'ticket_type')->dropDownList($types) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'payment_method')->dropDownList(Transfer::paymentMethods()) ?>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<?= $form->field($model, 'id_discount')->dropDownList( $discounts ) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<?= Html::submitButton( Yii::t('common/contract', 'Szerződés és első bérlet létrehozása') , ['class' => 'btn btn-success' ]) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php ActiveForm::end(); ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
@ -19,6 +19,10 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
echo Html::a( "Új szerződés",['contract/make' , 'id' => $searchModel->customer->id_customer ], ['class' => 'btn btn-success'])
|
||||||
|
?>
|
||||||
|
|
||||||
<?= GridView::widget([
|
<?= GridView::widget([
|
||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
|
|||||||
@ -14,6 +14,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
?>
|
?>
|
||||||
<?php echo CustomerTabWidget::widget(['card' => $model->customer->card,'title' => 'Szerződés részletek'])?>
|
<?php echo CustomerTabWidget::widget(['card' => $model->customer->card,'title' => 'Szerződés részletek'])?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="contract-view">
|
<div class="contract-view">
|
||||||
|
|
||||||
<?= DetailView::widget([
|
<?= DetailView::widget([
|
||||||
@ -54,6 +56,14 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<?php
|
||||||
|
echo Html::a("Szerződés letöltése ",['contract/contract' , 'id' => $model->id_contract], [ 'class' => 'btn btn-success']);
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
<?php }?>
|
<?php }?>
|
||||||
<?php foreach ($intstallments as $inst) {?>
|
<?php foreach ($intstallments as $inst) {?>
|
||||||
<?php
|
<?php
|
||||||
@ -90,7 +100,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( $inst->isStatusPending() || $inst->isStatusRejected() ){
|
if ( $inst->isStatusPending() || $inst->isStatusRejected() ){
|
||||||
echo Html::a("Fizetettnek jelölés és bérlet vásárló kásrba helyezése",['contract/payout' , 'id' => $inst->id_ticket_installment_request], [ 'data-method' => 'post', 'class' => 'btn btn-danger']);
|
echo Html::a("Fizetettnek jelölés és bérlet vásárló kosarába helyezése",['contract/payout' , 'id' => $inst->id_ticket_installment_request], [ 'data-method' => 'post', 'class' => 'btn btn-danger']);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,24 +0,0 @@
|
|||||||
<h1>
|
|
||||||
Éves szerződés
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Ez az éves szerződés szövege
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Kövektező bekezdés
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
A szerződő fél neve:
|
|
||||||
<span>
|
|
||||||
<?php
|
|
||||||
echo $model->name
|
|
||||||
?>
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<span>A cég neve:</span>
|
|
||||||
<span><?php echo \Yii::$app->params['company_name']?></span>
|
|
||||||
</p>
|
|
||||||
@ -54,6 +54,20 @@ use kartik\widgets\DatePicker;
|
|||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-6'>
|
||||||
|
<?= $form->field($model, 'mother_name')->textInput(['maxlength' => true]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?= $form->field($model, 'birth_place')->textInput(['maxlength' => true]) ?>
|
||||||
|
</div>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
|
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
@ -78,6 +92,8 @@ use kartik\widgets\DatePicker;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-6'>
|
<div class='col-md-6'>
|
||||||
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
<?= $form->field($model, 'description')->textarea(['maxlength' => true]) ?>
|
||||||
|
|||||||
@ -49,8 +49,20 @@ use yii\base\Widget;
|
|||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
|
<div class='col-md-6'>
|
||||||
|
<?= $form->field($model, 'mother_name')->textInput(['maxlength' => true]) ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?php echo $form->field($model, 'birthdate',[ ] )->widget(DatePicker::classname(), [
|
<?= $form->field($model, 'birth_place')->textInput(['maxlength' => true]) ?>
|
||||||
|
</div>
|
||||||
|
<div class='col-md-3'>
|
||||||
|
<?= $form->field($model, 'birthdate')->widget(DatePicker::classname(), [
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
'autoclose'=>true,
|
'autoclose'=>true,
|
||||||
'format' => 'yyyy.mm.dd'
|
'format' => 'yyyy.mm.dd'
|
||||||
@ -59,6 +71,8 @@ use yii\base\Widget;
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
|
||||||
|
|||||||
@ -68,19 +68,23 @@ AppAsset::register($this);
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer" style="min-height: 60px; height: auto;">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
<p class="pull-left">© <?= Yii::$app->name ?> <?= Yii::$app->params['version'] ?> Fitness - WebAdmin <?= date('Y') ?></p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
</div>
|
||||||
|
|
||||||
<div>
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
Ingyenesen használható alkalmazás.
|
||||||
Az oldalon szereplő adatok csak tájékoztató jellegűek.<br>
|
Az oldalon szereplő adatok csak tájékoztató jellegűek.<br>
|
||||||
Az adatok helyességéért és igazságtartalmáért felelősséget nem vállalunk.<br>
|
Az adatok helyességéért és igazságtartalmáért felelősséget nem vállalunk.<br>
|
||||||
Az oldal nem használható hivatalos adatforrásként.<br>
|
Az oldal nem használható hivatalos adatforrásként.<br>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<?php $this->endBody() ?>
|
<?php $this->endBody() ?>
|
||||||
|
|||||||
BIN
frontend/web/images/cutler_contract_pdf_header.jpg
Normal file
BIN
frontend/web/images/cutler_contract_pdf_header.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
Loading…
Reference in New Issue
Block a user