ks hai 3 meses
pai
achega
6a6f4f934e

+ 13 - 0
.env-dist

@@ -0,0 +1,13 @@
+YII_DEBUG=1
+YII_ENV='dev'
+
+DB_HOST='localhost'
+DB_NAME='c1nrc'
+DB_USER='c1neiron'
+DB_PASS='neiron22'
+
+SMTP_HOST='smtp.zoho.eu'
+SMTP_USER='etm@react-logic.com'
+SMTP_PASS='neiron22'
+SMTP_PORT='587'
+SMTP_ENC='tls'

+ 5 - 5
components/Templater.php

@@ -42,18 +42,18 @@ class Templater extends Component
     {
         $path = $filepath ?: Yii::getAlias('@runtime/tmp');
         FileHelper::createDirectory($path);
-
+    
         $filename = "{$type}.docx";
         $newFilePath = $path . '/' . $filename;
 
-        $tplPath = Yii::getAlias($this->templatePath);
-
+        $tplPath = Yii::getAlias("@app/templates/{$type}.docx");
+    
         if (!file_exists($tplPath)) {
             throw new \Exception("Template not found: " . $tplPath);
         }
-
+    
         copy($tplPath, $newFilePath);
-
+    
         return $newFilePath;
     }
 }

+ 2 - 1
config/web.php

@@ -120,7 +120,7 @@ $config = [
                     'except' => ['delete']
                 ],// for rest api
                 'public/view/<id>' => 'public/view',
-               '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
+                // '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                 '<alias:register>' => 'user/registration/<alias>',
                 '<alias:logout|login>' => 'user/security/<alias>',
                 '/news/<name:[\w]+>' => '/site/view',
@@ -129,6 +129,7 @@ $config = [
                 //'/category/<slug:[\w-]+>' => '/categoriesblog/category',
                 //'/blog/<slug:[\w-]+>' => '/categoriesblog/category',
                 // '/page/<slug:[\w-]+>' => '/categoriesblog/page',
+                '/p/<slug:[\w-]+>' => '/categoriesblog/category',
             ]
         ],
         'assetManager'  =>  [

+ 51 - 39
controllers/BillsController.php

@@ -167,47 +167,59 @@ class BillsController extends Controller
         $model = $this->findModel($id);
         
         $type = $model->type;
-        $percent_g = 0.015;
-        $percent_r = 0.0015;
-        $amount_vat = $amount = $type == 'guarantee'
-            ? $percent_g*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 )
-            : $percent_r*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 );
-        if (isset($model->auction->lot) ? $model->auction->lot->nds : 0) {
-            $amount = $amount/1.2*1;
+        if($type == 'guarantee'){
+            $percent_g = 0.015;
+            $percent_r = 0.0015;
+            $amount_vat = $amount = $type == 'guarantee'
+                ? $percent_g*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 )
+                : $percent_r*(isset($model->auction->lot) ? $model->auction->lot->start_price : 0 );
+            if (isset($model->auction->lot) ? $model->auction->lot->nds : 0) {
+                $amount = $amount/1.2*1;
+            } else {
+                $amount_vat *= 1.2;
+            }
+            
+            $data = [            
+                'billid' => $model->id,
+                'date' => date('m.d.Y'),
+                'userfio' => (empty($model->profile->fio) ? $model->profile->member : $model->profile->fio),
+                'summ' => $amount_vat,
+                'letters' => Yii::$app->num2text->moneyFormatted($amount_vat),
+                'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
+                'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
+                'nopdv' => ($amount_vat - ($amount_vat / 100 * 20)),
+                'ypdv' => ($amount_vat / 100 * 20)
+                
+                // 'auctionID' => $model->auction->id,
+                // 'date' => date('d-m-Y'),
+                // 'inn' => $model->profile->inn,
+                // 'zkpo' => $model->profile->zkpo,
+                // 'uAddress' => $model->profile->u_address,
+                // 'bank' => $model->requisite->bank,
+                // 'payAccount' => $model->requisite->account,
+                // 'phone' => $model->profile->phone,
+                // 'fax' => $model->profile->fax,
+                // 'firmaFull' => $model->profile->firma_full,
+                // 'billType' => $type == 'guarantee'? 'Гарантійний внесок': 'Регістраційний внесок',
+                // 'amountString' => num2str($amount_vat),
+                // 'amountVat' => $amount_vat,
+                // 'amount' => $amount,
+                // 'vat' => $model->auction->lot->nds ? 'з ПДВ' : 'без ПДВ',
+            ];
         } else {
-            $amount_vat *= 1.2;
+            $amount_vat = 100.00;
+            $data = [            
+                'billid' => $model->id,
+                'date' => date('m.d.Y'),
+                'userfio' => (empty($model->profile->fio) ? $model->profile->member : $model->profile->fio),
+                'summ' => $amount_vat + 20,
+                'letters' => Yii::$app->num2text->moneyFormatted($amount_vat+20),
+                'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
+                'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
+                'nopdv' => $amount_vat,
+                'ypdv' => ($amount_vat / 100 * 20)
+            ];            
         }
-        
-        $data = [
-            'billid' => $model->id,
-            'date' => date('m.d.Y'),
-            'userfio' => (empty($model->profile->fio) ? 'Не знайдено' : $model->profile->fio),
-            'summ' => $amount_vat,
-            'letters' => Yii::$app->num2text->moneyFormatted($amount_vat),
-            'letterpdv' => Yii::$app->num2text->moneyFormatted(($amount_vat / 100 * 20)),
-            'aukinfo' => "№" . (empty($model->auction) ? 'Не знайдено' : $model->auction->id) . " " . (empty($model->auction) ? 'Не знайдено' : $model->auction->name),
-            'nopdv' => ($amount_vat - ($amount_vat / 100 * 20)),
-            'ypdv' => ($amount_vat / 100 * 20)
-            
-            // 'auctionID' => $model->auction->id,
-            // 'date' => date('d-m-Y'),
-            // 'inn' => $model->profile->inn,
-            // 'zkpo' => $model->profile->zkpo,
-            // 'uAddress' => $model->profile->u_address,
-            // 'bank' => $model->requisite->bank,
-            // 'payAccount' => $model->requisite->account,
-            // 'phone' => $model->profile->phone,
-            // 'fax' => $model->profile->fax,
-            // 'firmaFull' => $model->profile->firma_full,
-            // 'billType' => $type == 'guarantee'? 'Гарантійний внесок': 'Регістраційний внесок',
-            // 'amountString' => num2str($amount_vat),
-            // 'amountVat' => $amount_vat,
-            // 'amount' => $amount,
-            // 'vat' => $model->auction->lot->nds ? 'з ПДВ' : 'без ПДВ',
-        ];
-
-        // print_r($data);
-        // exit;
 
         $filename = templater()->process(
             $data,

+ 2 - 2
controllers/CategoriesblogController.php

@@ -34,12 +34,12 @@ class CategoriesblogController extends Controller
                 'rules' => [
                     [
                         'allow' => true,
-                        'actions' => ['create', 'update', 'delete', 'index', 'category', 'view', 'blog'],
+                        'actions' => ['create', 'update', 'delete', 'index', 'category', 'view', 'blog','page'],
                         'roles' => ['@'],
                     ],
                     [
                         'allow' => true,
-                        'actions' => ['index', 'category', 'view', 'blog'],
+                        'actions' => ['index', 'category', 'view', 'blog','page'],
                         'roles' => ['?'],
                     ],
                 ],

+ 0 - 8
controllers/LotsController.php

@@ -148,11 +148,7 @@ class LotsController extends Controller
                     'user_id'=>Yii::$app->user->identity->id,
                     'auction_id'=>'null',
                     'lot_id'=>$model->id,
-<<<<<<< HEAD
                     'type'  =>  'project_dogovor'
-=======
-                    'type'  =>  'NULL'
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ]);
                 $model->updateAttributes(['dogovor_id' => $dogovor_id]);
             }
@@ -244,11 +240,7 @@ class LotsController extends Controller
                     'user_id'=>Yii::$app->user->identity->id,
                     'auction_id'=>'null',
                     'lot_id'=>$model->id,
-<<<<<<< HEAD
                     'type'  =>  'project_dogovor'
-=======
-                    'type'  =>  'NULL'
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ]);
                 $model->updateAttributes(['dogovor_id' => $dogovor_id]);
             }

+ 31 - 0
models/Lots.php

@@ -166,6 +166,37 @@ class Lots extends ActiveRecord
             $requisite->title = $requisite->title . ' - ' . $requisite->account . ' / ' .  $requisite->bank;
         }
         return \yii\helpers\ArrayHelper::map($requisites, 'id', 'title');
+    }
+    
+    public function getBillPayDocument($type = 'registration')
+    {
+        if($type == 'registration'){
+            return Bills::find()
+            ->alias('b')
+            ->leftJoin('bidding bd', 'b.bid_id = bd.id')
+            ->where([
+                'b.type' => $type,
+                'b.user_id' => Yii::$app->user->id,                
+            ])
+            ->select('b.id')
+            ->scalar();
+        } else {
+            return Bills::find()
+            ->alias('b')
+            ->leftJoin('bidding bd', 'b.bid_id = bd.id')
+            ->where([
+                'b.type' => $type,
+                'b.user_id' => Yii::$app->user->id,
+                'bd.auction_id' => $this->auction->id,
+            ])
+            ->select('b.id')
+            ->scalar();
+        }
+    }
+
+    public function getUser()
+    {
+        return $this->hasOne(User::className(),['id' => 'user_id']);
     }    
 
     public function getBillPayRegistration() {

BIN=BIN
templates/guarantee.docx


BIN=BIN
templates/registration.docx


+ 0 - 18
views/auctions/view.php

@@ -58,30 +58,12 @@ $type_action = Yii::t('app', 'AuctionType ID');
                         <?php
                         if(Yii::$app->user->can('admin') || Yii::$app->user->can('org'))
                         {
-
                             if($model->status >= "2") // && $model->type_id=="1")
                             {
                                 //$auction = Auctions::find()->with('winners')->where(['id' => 48])->one();
                                 //$winners = $auction->winners;                                
 
                                 $winners = $model->winners;
-                                // print_r(count($winners));
-                                if($winners)
-                                {
-                                    if(count($winners)==2)
-                                    {
-                                        ?>
-                                        <!-- <dt><?= Html::encode(Yii::t('app', 'Winner1 ID')) ?>:</dt><dd><?= Html::encode($model->winners['0']->at_org." / ".$model->winners['0']->date." / ".$model->winners['0']->comment) ?></dd> -->
-                                        <!-- <dt><?= Html::encode(Yii::t('app', 'Winner2 ID')) ?>:</dt><dd><?= Html::encode($model->winners['1']->at_org." / ".$model->winners['1']->date." / ".$model->winners['1']->comment) ?></dd> -->
-                                        <?php
-                                    }
-                                    if(count($winners)==1)
-                                    {
-                                        ?>
-                                        <!-- <dt><?= Html::encode(Yii::t('app', 'Winner1 ID')) ?>:</dt><dd><?= Html::encode($model->winners['0']->at_org . " / " . $model->winners['0']['date'] . " / " . $model->winners['0']['comment']) ?></dd> -->
-                                        <?php
-                                    }
-                                }
 
                             }
                         }

+ 4 - 0
views/bills/index.php

@@ -33,6 +33,10 @@ JS
             'filterModel' => $searchModel,
             'columns' => [
                 [
+                    'attribute' => 'id',
+                    'value' => 'id',                    
+                ],                
+                [
                     'attribute' => 'user_at_org',
                     'value' => 'user.at_org',
                     'visible' => Yii::$app->user->can('admin'),

+ 1 - 45
views/layouts/backend/left.php

@@ -37,7 +37,7 @@ if (Yii::$app->user->can('admin')) {
                     "label" => Yii::t('app', 'Аукціони'),
                     "url" => ["/lots"],
                     "icon" => "money",
-<<<<<<< HEAD
+                ],
                     // "items" => [
                     //     [
                     //         "label" => Yii::t('app', 'AukName ID'),
@@ -52,33 +52,6 @@ if (Yii::$app->user->can('admin')) {
                     //         "url" => ["/lots"],
                     //     ],
                     // ],
-=======
-                    "items" => [
-                        [
-                            "label" => Yii::t('app', 'AukName ID'),
-                            "url" => ["/auctions"],
-                        ],
-                        // [
-                        //     "label" => Yii::t('app', 'Template ID'),
-                        //     "url" => ["/auclots"],
-                        // ],
-                        [
-                            "label" => Yii::t('app', 'Lots ID'),
-                            "url" => ["/lots"],
-                        ],
-                    ],
-                ],
-                [
-                    "label" => Yii::t('app', 'Subscriptions'),
-                    "url" => ['/subscriptions'],
-                    "icon" => "plane",
-                ],
-                [
-                    "label" => Yii::t('app', 'Файли'),
-                    "url" => ['/files'],
-                    "icon" => "database",
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
-                ],
                 // [
                 //     "label" => Yii::t('app', 'Subscriptions'),
                 //     "url" => ['/subscriptions'],
@@ -286,7 +259,6 @@ if (Yii::$app->user->can('org')) {
                     "label" => Yii::t('app', 'Аукціони'),
                     "url" => ["/lots"],
                     "icon" => "money",
-<<<<<<< HEAD
                     // "items" => [
                     //     [
                     //         "label" => Yii::t('app', 'AukName ID'),
@@ -301,22 +273,6 @@ if (Yii::$app->user->can('org')) {
                     //         "url" => ["/lots"],
                     //     ],
                     // ],
-=======
-                    "items" => [
-                        [
-                            "label" => Yii::t('app', 'AukName ID'),
-                            "url" => ["/auctions"],
-                        ],
-                        // [
-                        //     "label" => Yii::t('app', 'Template ID'),
-                        //     "url" => ["/auclots"],
-                        // ],
-                        [
-                            "label" => Yii::t('app', 'Lots ID'),
-                            "url" => ["/lots"],
-                        ],
-                    ],
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                 ],
                 [
                     "label" => Yii::t('app', 'Bills'),

+ 1 - 7
views/lots/index.php

@@ -20,17 +20,11 @@ $this->params['breadcrumbs'][] = 'Аукціони';//$this->title;
     <div class="panel-heading"><span class="glyphicon glyphicon-th"></span><strong> <?= Html::encode($this->title) ?></strong></div>
     <div class="panel-body">
 
-<<<<<<< HEAD
             <!-- <ul class="nav nav-tabs">
                 <li role="presentation">
                     <?= Html::a(\Yii::t('app', 'Template ID'), ['auclots/index'], ['class' => 'presentation active']) ?>
                 </li>
-=======
-            <ul class="nav nav-tabs">
-                <!-- <li role="presentation">
-                    <?= Html::a(\Yii::t('app', 'Template ID'), ['auclots/index'], ['class' => 'presentation active']) ?>
-                </li> -->
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
+
                 <li role="presentation"  class="active">
                     <?= Html::a(\Yii::t('app', 'Lots ID'), ['/lots/index'], ['class' => 'presentation active']) ?>
                 </li>

+ 1 - 16
views/lots/view.php

@@ -93,11 +93,8 @@ $timeStepFormat = sprintf(
 <div class="panel panel-primary">
     <div class="panel-heading">
         <span class="glyphicon glyphicon-stats"></span>
-<<<<<<< HEAD
+
         <strong><?= Html::encode("(#" . $model->id . ") - " . $this->title) ?></strong>
-=======
-        <strong><?= Html::encode($this->title) ?></strong>
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
         
         <?php if(Yii::$app->user->id == $model->user_id || Yii::$app->user->can('admin')): ?>
             <?= Html::a(Yii::t('app', 'Update ID'), ['update', 'id' => $model->id], [
@@ -136,14 +133,11 @@ $timeStepFormat = sprintf(
                             'attributes' =>
                                 [
                                     [
-<<<<<<< HEAD
                                         'label' => 'Організатор аукціону',
                                         'value' => isset($model->auction) ? $model->auction->user->at_org : $model->user->at_org,
                                         'format' => 'raw',
                                     ],                                    
                                     [
-=======
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                                         'label' => 'Тип аукціону',
                                         'value' => function ($model){
                                             if($model->type == 1){
@@ -184,21 +178,12 @@ $timeStepFormat = sprintf(
                                         'label' => 'Крок',
                                         'value' => $serialize_data->step_change,
                                         'format' => 'raw',
-<<<<<<< HEAD
-                                    ],
-                                    [
-                                        'label' => 'Час',
-                                        'value' => $timeStepFormat,
-                                        'format' => 'raw',
-                                    ],
-=======
                                     ],
                                     [
                                         'label' => 'Час',
                                         'value' => $timeStepFormat,
                                         'format' => 'raw',
                                     ],
->>>>>>> 5bd9408fb32cecb076e639952fbeaaed915e69ce
                                 ],
                         ]); ?>
                         <?php endif; ?>