OSDN Git Service

Исправлен фильтр возможности печати инвентарного номера от имени пользователя.
[invent/invent.git] / views / items / print.php
1 <?php
2
3 use yii\helpers\Html;
4 use app\models\Items;
5 use app\models\Types;
6 use app\models\User;
7
8 use xj\qrcode\QRcode;
9 use xj\qrcode\widgets\Email;
10 use xj\qrcode\widgets\Text;
11
12 if (! User::canPermission('takingInventory'))
13 {
14     return Yii::$app->response->redirect(['site/index']);
15 }
16
17 $this->title = Yii::t('items', 'Items');
18 $this->params[ 'breadcrumbs' ][] = $this->title;
19
20 ?>
21 <div class="items-index">
22
23     <table width="100%">
24         <tbody>
25             <?php
26                 $counts = 3;
27                 $percent = (100 / $counts) % 100;
28                 $ind = 0;
29                 foreach ($models as $model )
30                 {
31             ?>
32
33                 <?php
34                     if ($ind % $counts == 0)
35                     {
36                         echo '<tr style="height:120px;min-height:120px;max-height:120px;">';
37                     }
38                     $ind++;
39                 ?>
40                 <td style="width:<?= $percent ?>%;">
41                     <div style="margin:2px 2px 2px 2px;border-color:black;border-width:4,4;border-style:double;border-radius:15px;height:94%;width:98%">
42                         <table width="100%" height="100%">
43                             <tbody>
44                                 <tr>
45                                     <td style="vertical-align:middle;">
46                                         <?= Text::widget([
47                                             'outputDir'    => '@webroot/upload/qrcode',
48                                             'outputDirWeb' => '@web/upload/qrcode',
49                                             'text'         => $model->invent . ', ' . $model->serial,
50                                             'size'         => 3,
51                                             'margin'       => 4,
52                                             'ecLevel'      => QRcode::QR_ECLEVEL_L,
53                                         ]) ?>
54                                     </td>
55                                     <td style="vertical-align:middle;">
56                                         <?= $model->invent . ', ' . $model->models->name ?>
57                                     </td>
58                                 </tr>
59                             </tbody>
60                         </table>
61                     </div>
62                 </td>
63                 <?php
64                     if ($ind % $counts == 0)
65                     {
66                         echo '</tr>';
67                     }
68                 }
69                 if ($ind % $counts != 0)
70                 {
71                     while ($ind % $counts != 0)
72                     {
73                         echo '<td>&nbsp;</td>';
74                         $ind++;
75                     }
76                     echo '</tr>';
77                 }
78             ?>
79         </tbody>
80     </table>
81 </div>