__form.php 4.57 KB
Newer Older
Яков's avatar
first  
Яков committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>
<?php echo form_tag_for($form, '@user') ?>

<div id="lui_scroller" class="lui__scroller_class">
<div class="lui__scroller_wrapper" style="position:relative;z-index:102;padding-left:10px;">
    <?php foreach ($configuration->getFormFields($form, $form->isNew() ? 'new' : 'edit') as $fieldset => $fields): ?>
      <?php include_partial('user/form_fieldset', array('user' => $user, 'form' => $form, 'fields' => $fields, 'fieldset' => $fieldset)) ?>
    <?php endforeach; ?>
<?php 
  $user = $form->getObject();
  if (!$user->isNew())
  {
    if (!empty($user['current_discount']))
    {
      $discount = round($user['current_discount']) . '%';
      echo 'Текущая скидка: <b>' . $discount . '</b>.<br />'; 
    }
    $salesPr = $user->getProductDiscount();
    if (($salesPr[0]->getProductCode()) !== null)
    {
      //echo 'Дополнительные скидки по продуктам';
      echo ' <table class="lui__list_table lui__list_table_donor lui__list_table__sourse" cellspacing="0">
          <th class = "" style="border_bottom: 1px solid black; vertical-align:middle; width:400px;">
            Товар
          </th>
          <th>
            Код
          </th>
          <th>
            Скидка
          </th>
          ';
      foreach ($salesPr as $product)
      {
        echo '<tr style="vertical-align:middle;">';
        echo '<td>' . $product->getTitle() . '</td>';
        echo '<td>' . $product->getProductCode() . '</td>';
        echo '<td style="text-align:right;">' . (round($product->getDiscountValue()) . ' %') . '</td>';
        echo '</tr>';
      }      
      echo '</table>';
    }
    $supplier = $user->getClientDiscount();
     if (($supplier[0]->getDiscountValue()) !== null)
    {
      //echo 'Дополнительные скидки по продуктам';
      echo ' <table class="lui__list_table lui__list_table_donor lui__list_table__sourse" cellspacing="0">
          <th class = "" style="border_bottom: 1px solid black; vertical-align:middle; width:400px;">
            ИНН поставщика
          </th>
          <th>
            Скидка
          </th>
          ';
      foreach ($supplier as $discount)
      {
        echo '<tr style="vertical-align:middle;">';
        echo '<td>' . $discount->getInnSupplier() . '</td>';
        echo '<td style="text-align:right;">' . (round($discount->getDiscountValue()) . ' %') . '</td>';
        echo '</tr>';
      }      
      echo '</table>';
    }
    echo '<p>Долг: <b>' .( ($user->getCurrentDebt() == '')? 0 : $user->getCurrentDebt()) . '</b> руб.</p><br/>';

    $debt = $user->getDebt();
    $month = array(
      '01' => 'января',
      '02' => 'февраля',
      '03' => 'марта',
      '04' => 'апреля',
      '05' => 'мая',
      '06' => 'июня',
      '07' => 'июля',
      '08' => 'августа',
      '09' => 'сентября',
      '10' => 'октября',
      '11' => 'ноября',
      '12' => 'декабря'
    );
    if ($debt[0]->getDebtSum() !== null)
    {
      echo ' <table class="lui__list_table lui__list_table_donor lui__list_table__sourse" cellspacing="0">
          <th style="text-align:center; width:100px;">
            Сумма
          </th>
          <th style="text-align:center; width:150px;">
            Крайний срок
          </th>
          ';
      foreach ($debt as $detail)
      {
        $deadline = $detail->getDeadline();
        $deadline = array_reverse(explode('-', $deadline));
        $deadline[1] = $month[$deadline[1]];
        $deadline[2] = $deadline[2] . ' г.';
        $deadline = implode(' ', $deadline);

        echo '<tr style="vertical-align:middle;">';
        echo '<td style="text-align:right;">' . $detail->getDebtSum() . '</td>';
        echo '<td style="text-align:right;">' . $deadline . '</td>';
        echo '</tr>';
      }      
      echo '</table>';
    }
    if (!empty($user['limit_by_sum']))
    {
      $sum_limit = $user['limit_by_sum'];
      if ($sum_limit == 'Неограниченно')
      {
        echo '<p>Лимит по сумме: <b>' . $sum_limit . '</b>.</p><br />';
      }
      else
      {
        echo '<p>Лимит по сумме: <b>' . $sum_limit . '</b> руб.</p><br />';
      }
    }
   
  }
?>
<span class="br10"></span>
<div class="lui__list_actions__wrapper">
  <?php include_partial('user/form_actions', array('user' => $user, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper)) ?>
</div>
<span class="br30"></span>
</div>
</div>
</form>