]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-37 Не выводятся ночные сотрудники в Продажах сегодня
authorMarina Zozirova <marina.zozirova@erp-flowers.ru>
Wed, 20 Nov 2024 06:53:42 +0000 (06:53 +0000)
committerAleksey Filippov <aleksey.filippov@erp-flowers.ru>
Wed, 20 Nov 2024 06:53:42 +0000 (06:53 +0000)
erp24/actions/dashboard/SalesAction.php
erp24/views/dashboard/sales.php
erp24/web/css/timetable/style.css

index 9aaab569044f06f216646ca3c653de0ff700f5ac..d9ab4a7561d0302684bbc0f22911fcbc4e5e01cd 100755 (executable)
@@ -15,6 +15,7 @@ use yii_app\records\Products1c;
 use yii_app\records\Sales;
 use yii_app\records\Shift;
 use yii_app\records\StorePlanIncreaseHolidays;
+use yii_app\records\Timetable;
 use yii_app\services\DashboardService;
 use yii_app\services\ExportImportService;
 use yii_app\services\SalesProductsService;
@@ -127,6 +128,26 @@ class SalesAction extends Action
             ];
         }
 
+        $admins = [];
+
+        if ($date1 == $date2) {
+            $admins = Timetable::find()
+                ->alias('t')
+                ->leftJoin(['a' => 'admin'], 't.admin_id = a.id')
+                ->leftJoin('export_import_table e', 'entity_id = t.store_id and entity = \'city_store\'')
+                ->where(['=', 'date', $date1])
+                ->select([
+                    'e.export_val AS store_id',
+                    new \yii\db\Expression(
+                        "ARRAY_AGG(DISTINCT ARRAY[a.name_full, a.group_id::TEXT]) AS admins"
+                    )
+                ])
+                ->groupBy('e.export_val')
+                ->indexBy('store_id')
+                ->asArray()
+                ->all();
+        }
+
         $dashboardService = new DashboardService();
 
         $store_traffik = $dashboardService->getStoreTraffic($dataStoreVisitorsPrepared);
@@ -247,7 +268,6 @@ class SalesAction extends Action
         $sales_store_summ_all = ArrayHelper::getValue($salesStore, 'sales_store_summ_all');
         $sales_store_summ_date1_all = ArrayHelper::getValue($salesStore, 'sales_store_summ_all.' . $date1);
 
-
         $new_client_by_date = UsersService::getNewClientByDate($date1, $date2);
 
         $new_client = UsersService::getNewClient($new_client_by_date);
@@ -294,6 +314,7 @@ class SalesAction extends Action
             'servises' => $servises,
             'saleServices' => $saleServices,
             'daysSearchForm' => $daysSearchForm,
+            'admins' => $admins
         ];
 
         return $this->controller->render('/dashboard/sales.php', $params);
index cd5ed7d17dd6c7f2c13bd60ed8fd05f63335a5d6..0f7308052e56f6a4ac4a50a3b8e7181574e094b0 100755 (executable)
@@ -55,8 +55,7 @@ tr.line.bg-danger>td>a.btn {
 
 ?>
 <h2>Продажи</h2>
-<?php
-?>
+
 <?php $searchForm = \yii\widgets\ActiveForm::begin([
         'id' => 'days-search-form',
         'enableAjaxValidation' => true,
@@ -224,6 +223,39 @@ foreach ($sales as $key => $arr) {
         $salesCalculateCountByTypeRow = $salesCalculateCountByType[$arr["store_id"]];
     }
 
+    $adminRes = '';
+    
+    if (array_key_exists($arr['store_id'], $admins)) {
+        foreach ($admins[$arr['store_id']] as $key => $admin) {
+            if ($key === 'admins') {
+                $string = '[' . str_replace(['NULL', '{', '}'], ['null', '[', ']'], $admin) . ']';
+                $result = json_decode($string, true);
+                foreach ($result[array_key_first($result)] as $str) {
+                    $class = '';
+
+                    switch ($str[1]) {
+                        case 45:
+                            $class = "workers-sales";
+                            break;
+                        case 50:
+                            $class = "admin-sales";
+                            break;
+                        case 30:
+                        case 35:
+                            $class = "florist-sales";
+                            break;
+                        default:
+                            $class = "default-sales";
+                    }
+
+                    $class .= ($count <= 3 || $i <= 3) ? " border-sales" : '';
+                    $adminRes .= "<div class='$class'>" . $str[0] . '</div>';
+                }
+            }
+        }
+    }
+
+
     echo "
     <tr class='" . $classRow . " line'>
         <td>" . $arr["store"] . "</td>
@@ -234,7 +266,7 @@ foreach ($sales as $key => $arr) {
         <td>" . $arr["summ"] . "</td>
         <td>" . $arr["plan"] . "</td>
         <td>" . $arr["percent"] . "%</td>
-        <td>" . $storeInRow . "</td>
+        <td>" . $adminRes . "</td>
         <td>+" . $new_client_date1 . " = $konvNew%</td>
         <td>" . $salesCalculateCountByTypeRow . "%</td>
  
index c1a6b3b6fbf9b9e3f6dd2d7352890037877c1e00..aa7f7b50212ec17459d37bca78164f96a86d35c0 100644 (file)
   color: var(--text-florist-color);
 }
 
-.border-frame {
-  border-color: var(--border-photo-color) !important;
-}
-.border-main-block {
-  border: 1px solid rgba(78, 70, 180, 0.17) !important;
+.florist-sales {
+  color: var(--text-florist-color);
+  background: var(--bg-florist-color);
+  border: 3px solid var(--bg-florist-color);
+  border-radius: 5px;
+  display: inline-block;
+  margin: 3px 4px;
+  padding: 2px;
 }
 
-.bell-img {
-  width: 2.5rem;
-  height: 2.5rem;
-  background: url("../../images/Bell.png") center center/cover no-repeat;
+.admin-sales {
+  color: var(--text-admin-color);
+  background: var(--bg-admin-color);
+  border: 3px solid var(--bg-admin-color);
+  border-radius: 5px;
+  display: inline-block;
+  margin: 3px 4px;
 }
 
-.notifications {
-  position: absolute;
-  top: 0.75em;
-  right: 0.45rem;
-  width: 0.975rem;
-  height: 0.975rem;
-  border-radius: 6.25rem;
-  background: #eb5757;
-}
-.left-arrow {
-  display: block;
-  width: 1.9125rem;
-  height: 2.3125rem;
-  background: url("../../images/left-arrow.png") center center/cover no-repeat;
+.workers-sales {
+  color: black;
+  background: yellow;
+  border: 3px solid yellow;
+  border-radius: 5px;
+  display: inline-block;
+  margin: 3px 4px;
 }
-.opening-flower {
-  width: 10rem;
-  height: 8rem;
-  background: url("../../images/opening-flower.jpg") center center/cover no-repeat;
+
+.default-sales {
+  color: black;
+  background: orange;
+  border: 3px solid orange;
+  border-radius: 5px;
+  display: inline-block;
+  margin: 3px 4px;
 }
-.closure-flower {
-  width: 10rem;
-  height: 8rem;
-  background: url("../../images/flower-closure.png") center center/cover no-repeat;
+
+.border-sales {
+  border: 1px solid #ffffff;
+  padding:2px;
 }
-.icon-time::after {
-  content: "";
-  margin-left: 0.4rem;
-  display: block;
-  width: 0.9rem;
-  height: 0.9rem;
-  background: url("../../images/icon-time.png") center center/cover no-repeat;
+
+.border-frame {
+  border-color: var(--border-photo-color) !important;
 }
+  .border-main-block {
+    border: 1px solid rgba(78, 70, 180, 0.17) !important;
+  }
 
-/* стили для оценки настроения смайликами НАЧАЛО*/
+  .bell-img {
+    width: 2.5rem;
+    height: 2.5rem;
+    background: url("../../images/Bell.png") center center/cover no-repeat;
+  }
 
-fieldset {
-  margin: 0 auto;
-}
+  .notifications {
+    position: absolute;
+    top: 0.75em;
+    right: 0.45rem;
+    width: 0.975rem;
+    height: 0.975rem;
+    border-radius: 6.25rem;
+    background: #eb5757;
+  }
+  .left-arrow {
+    display: block;
+    width: 1.9125rem;
+    height: 2.3125rem;
+    background: url("../../images/left-arrow.png") center center/cover no-repeat;
+  }
+  .opening-flower {
+    width: 10rem;
+    height: 8rem;
+    background: url("../../images/opening-flower.jpg") center center/cover no-repeat;
+  }
+  .closure-flower {
+    width: 10rem;
+    height: 8rem;
+    background: url("../../images/flower-closure.png") center center/cover no-repeat;
+  }
+  .icon-time::after {
+    content: "";
+    margin-left: 0.4rem;
+    display: block;
+    width: 0.9rem;
+    height: 0.9rem;
+    background: url("../../images/icon-time.png") center center/cover no-repeat;
+  }
 
-legend {
-  margin-bottom: 0.5rem;
-}
+  /* стили для оценки настроения смайликами НАЧАЛО*/
 
-input[type="radio"] {
-  border: 0.188rem solid black;
-}
+  fieldset {
+    margin: 0 auto;
+  }
 
-.rating {
-  display: block;
-  position: relative;
-  min-height: 3.75rem;
-  padding: 0;
-  border: none;
-}
+  legend {
+    margin-bottom: 0.5rem;
+  }
 
-.rating > input {
-  position: absolute;
-  margin-right: -100%;
-  opacity: 0;
-}
+  input[type="radio"] {
+    border: 0.188rem solid black;
+  }
 
-.rating > input:checked ~ label,
-.rating > input:focus ~ label {
-  background-position: 0 0;
-}
+  .rating {
+    display: block;
+    position: relative;
+    min-height: 3.75rem;
+    padding: 0;
+    border: none;
+  }
 
-.rating > input:checked + label,
-.rating > input:focus + label {
-  background-position: 0 -1.875rem;
-}
+  .rating > input {
+    position: absolute;
+    margin-right: -100%;
+    opacity: 0;
+  }
 
-.rating > input:hover ~ label {
-  background-position: 0 0;
-}
+  .rating > input:checked ~ label,
+  .rating > input:focus ~ label {
+    background-position: 0 0;
+  }
 
-.rating > input:hover + label {
-  background-position: 0 -1.875rem;
-}
+  .rating > input:checked + label,
+  .rating > input:focus + label {
+    background-position: 0 -1.875rem;
+  }
 
-.rating > input:hover + label:before {
-  opacity: 1;
-}
+  .rating > input:hover ~ label {
+    background-position: 0 0;
+  }
 
-.rating .focus-ring {
-  position: absolute;
-  left: 0;
-  width: 100%;
-  height: 1.875rem;
-  outline: 2px dotted #999;
-  pointer-events: none;
-  opacity: 0;
-}
+  .rating > input:hover + label {
+    background-position: 0 -1.875rem;
+  }
 
-.rating > .input-no-rate:focus ~ .focus-ring {
-  opacity: 1;
-}
+  .rating > input:hover + label:before {
+    opacity: 1;
+  }
 
-.rating > label {
-  position: relative;
-  float: left;
-  width: 1.875rem;
-  font-size: 0.1em;
-  color: transparent;
-  cursor: pointer;
-  background-repeat: no-repeat;
-  background-position: 0 -1.875rem;
-}
+  .rating .focus-ring {
+    position: absolute;
+    left: 0;
+    width: 100%;
+    height: 1.875rem;
+    outline: 2px dotted #999;
+    pointer-events: none;
+    opacity: 0;
+  }
 
-.rating > label,
-.rating > label:before {
-  height: 1.875rem;
-  background-image: url("../../images/smile.png");
-}
+  .rating > .input-no-rate:focus ~ .focus-ring {
+    opacity: 1;
+  }
 
-.star > label:before {
-  content: "";
-  position: absolute;
-  display: block;
-  background-position: 0 1.875rem;
-  pointer-events: none;
-  opacity: 0;
-}
+  .rating > label {
+    position: relative;
+    float: left;
+    width: 1.875rem;
+    font-size: 0.1em;
+    color: transparent;
+    cursor: pointer;
+    background-repeat: no-repeat;
+    background-position: 0 -1.875rem;
+  }
 
-.star > label:nth-of-type(5):before {
-  width: 7.5rem;
-  left: -7.5rem;
-}
+  .rating > label,
+  .rating > label:before {
+    height: 1.875rem;
+    background-image: url("../../images/smile.png");
+  }
 
-.star > label:nth-of-type(4):before {
-  width: 5.625rem;
-  left: -5.625rem;
-}
+  .star > label:before {
+    content: "";
+    position: absolute;
+    display: block;
+    background-position: 0 1.875rem;
+    pointer-events: none;
+    opacity: 0;
+  }
 
-.star > label:nth-of-type(3):before {
-  width: 3.75rem;
-  left: -3.75rem;
-}
+  .star > label:nth-of-type(5):before {
+    width: 7.5rem;
+    left: -7.5rem;
+  }
 
-.star > label:nth-of-type(2):before {
-  width: 1.875rem;
-  left: -1.875rem;
-}
+  .star > label:nth-of-type(4):before {
+    width: 5.625rem;
+    left: -5.625rem;
+  }
 
-.star > label:nth-of-type(1):before {
-  width: 0;
-  left: 0;
-}
-/* стили для оценки настроения смайликами КОНЕЦ*/
-
-/* стили прогресс-бара НАЧАЛО */
-.progress-bar {
-  display: flex;
-  flex-direction: row !important;
-  align-items: center;
-  width: 80%;
-  justify-content: left !important;
-  background: var(--bg-progressbar-color) !important;
-}
+  .star > label:nth-of-type(3):before {
+    width: 3.75rem;
+    left: -3.75rem;
+  }
 
-.rounded-top-3 {
-  border-top-left-radius: var(--bs-border-radius-lg) !important;
-  border-top-right-radius: var(--bs-border-radius-lg) !important;
-}
+  .star > label:nth-of-type(2):before {
+    width: 1.875rem;
+    left: -1.875rem;
+  }
 
-.step {
-  width: 1rem;
-  height: 1rem;
-  border: 0.125rem solid #c29ffa;
-  border-radius: 50%;
-  background-color: #fff;
-}
+  .star > label:nth-of-type(1):before {
+    width: 0;
+    left: 0;
+  }
+  /* стили для оценки настроения смайликами КОНЕЦ*/
+
+  /* стили прогресс-бара НАЧАЛО */
+  .progress-bar {
+    display: flex;
+    flex-direction: row !important;
+    align-items: center;
+    width: 80%;
+    justify-content: left !important;
+    background: var(--bg-progressbar-color) !important;
+  }
 
-.line {
-  height: 0.313rem;
-  width: 15%; /* Ширина полосы между кружочками */
-  background-color: #fff;
-}
+  .rounded-top-3 {
+    border-top-left-radius: var(--bs-border-radius-lg) !important;
+    border-top-right-radius: var(--bs-border-radius-lg) !important;
+  }
 
-/*
-.active {
-  background-color: #9747ff;
-  border-color: #9747ff;
-}
-*/
-.line-active {
-  background-color: var(--line-active-color);
-  border-color: var(--line-active-color);
-}
+  .step {
+    width: 1rem;
+    height: 1rem;
+    border: 0.125rem solid #c29ffa;
+    border-radius: 50%;
+    background-color: #fff;
+  }
 
-/* стили прогресс-бара КОНЕЦ */
+  .line {
+    height: 0.313rem;
+    width: 15%; /* Ширина полосы между кружочками */
+    background-color: #fff;
+  }
 
-/* --------------------------------------------------------- */
+  /*
+  .active {
+    background-color: #9747ff;
+    border-color: #9747ff;
+  }
+  */
+  .line-active {
+    background-color: var(--line-active-color);
+    border-color: var(--line-active-color);
+  }
+
+  /* стили прогресс-бара КОНЕЦ */
+
+  /* --------------------------------------------------------- */
 
-@media (max-width: 992px) {
-  .hidden-mobile {
-    display: none;
+  @media (max-width: 992px) {
+    .hidden-mobile {
+      display: none;
+    }
   }
-}
 
 
-/**/
-.bg-body-secondary {
-  --bs-bg-opacity: 1;
-  background-color: rgba(var(--bs-secondary-bg-rgb),var(--bs-bg-opacity)) !important;
-}
+  /**/
+  .bg-body-secondary {
+    --bs-bg-opacity: 1;
+    background-color: rgba(var(--bs-secondary-bg-rgb),var(--bs-bg-opacity)) !important;
+  }
 
-.text-body-tertiary {
-  --bs-text-opacity: 1;
-  color: var(--bs-tertiary-color) !important;
-}
+  .text-body-tertiary {
+    --bs-text-opacity: 1;
+    color: var(--bs-tertiary-color) !important;
+  }
 
-hr {
-  margin: 1rem 0;
-  color: inherit;
-  border: 0;
-  border-top-width: 0px;
-  border-top-style: none;
-  border-top-color: currentcolor;
-  border-top: var(--bs-border-width) solid;
-  opacity: .25;
-}
+  hr {
+    margin: 1rem 0;
+    color: inherit;
+    border: 0;
+    border-top-width: 0px;
+    border-top-style: none;
+    border-top-color: currentcolor;
+    border-top: var(--bs-border-width) solid;
+    opacity: .25;
+  }
 
-#liveAlertPlaceholder .alert-success {
-  --bs-alert-color: var(--bs-success-text-emphasis);
-  --bs-alert-bg: var(--bs-success-bg-subtle);
-  --bs-alert-border-color: var(--bs-success-border-subtle);
-  --bs-alert-link-color: var(--bs-success-text-emphasis);
-}
-#liveAlertPlaceholder .alert-dismissible {
-  padding-right: 3rem;
-}
-#liveAlertPlaceholder .alert {
-  --bs-alert-bg: transparent;
-  --bs-alert-padding-x: 1rem;
-  --bs-alert-padding-y: 1rem;
-  --bs-alert-margin-bottom: 1rem;
-  --bs-alert-color: inherit;
-  --bs-alert-border-color: transparent;
-  --bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
-  --bs-alert-border-radius: var(--bs-border-radius);
-  --bs-alert-link-color: inherit;
-  position: relative;
-  padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
-  margin-bottom: var(--bs-alert-margin-bottom);
-  color: var(--bs-alert-color);
-  background-color: #38cb8996!important;
-  border: var(--bs-alert-border);
-  border-radius: var(--bs-alert-border-radius);
-}
+  #liveAlertPlaceholder .alert-success {
+    --bs-alert-color: var(--bs-success-text-emphasis);
+    --bs-alert-bg: var(--bs-success-bg-subtle);
+    --bs-alert-border-color: var(--bs-success-border-subtle);
+    --bs-alert-link-color: var(--bs-success-text-emphasis);
+  }
+  #liveAlertPlaceholder .alert-dismissible {
+    padding-right: 3rem;
+  }
+  #liveAlertPlaceholder .alert {
+    --bs-alert-bg: transparent;
+    --bs-alert-padding-x: 1rem;
+    --bs-alert-padding-y: 1rem;
+    --bs-alert-margin-bottom: 1rem;
+    --bs-alert-color: inherit;
+    --bs-alert-border-color: transparent;
+    --bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
+    --bs-alert-border-radius: var(--bs-border-radius);
+    --bs-alert-link-color: inherit;
+    position: relative;
+    padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
+    margin-bottom: var(--bs-alert-margin-bottom);
+    color: var(--bs-alert-color);
+    background-color: #38cb8996!important;
+    border: var(--bs-alert-border);
+    border-radius: var(--bs-alert-border-radius);
+  }
 
 
-/**/
+  /**/
 
-#liveAlertPlaceholder .alert-dismissible .btn-close {
-  position: absolute;
-  top: 0;
-  right: 0;
-  z-index: 2;
-  padding: 1.25rem 1rem;
-}
-[type="button"]:not(:disabled), [type="reset"]:not(:disabled), [type="submit"]:not(:disabled), button:not(:disabled) {
-  cursor: pointer;
-}
-#liveAlertPlaceholder .btn-close {
-  --bs-btn-close-color: #000;
-  --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
-  --bs-btn-close-opacity: 0.5;
-  --bs-btn-close-hover-opacity: 0.75;
-  --bs-btn-close-focus-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
-  --bs-btn-close-focus-opacity: 1;
-  --bs-btn-close-disabled-opacity: 0.25;
-  --bs-btn-close-white-filter: invert(1) grayscale(100%) brightness(200%);
-  box-sizing: content-box;
-  width: 1em;
-  height: 1em;
-  padding: .25em .25em;
-  color: var(--bs-btn-close-color);
-  background: transparent var(--bs-btn-close-bg) center/1em auto no-repeat;
-  border: 0;
-  border-radius: .375rem;
-  opacity: var(--bs-btn-close-opacity);
+  #liveAlertPlaceholder .alert-dismissible .btn-close {
+    position: absolute;
+    top: 0;
+    right: 0;
+    z-index: 2;
+    padding: 1.25rem 1rem;
+  }
+  [type="button"]:not(:disabled), [type="reset"]:not(:disabled), [type="submit"]:not(:disabled), button:not(:disabled) {
+    cursor: pointer;
+  }
+  #liveAlertPlaceholder .btn-close {
+    --bs-btn-close-color: #000;
+    --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
+    --bs-btn-close-opacity: 0.5;
+    --bs-btn-close-hover-opacity: 0.75;
+    --bs-btn-close-focus-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
+    --bs-btn-close-focus-opacity: 1;
+    --bs-btn-close-disabled-opacity: 0.25;
+    --bs-btn-close-white-filter: invert(1) grayscale(100%) brightness(200%);
+    box-sizing: content-box;
+    width: 1em;
+    height: 1em;
+    padding: .25em .25em;
+    color: var(--bs-btn-close-color);
+    background: transparent var(--bs-btn-close-bg) center/1em auto no-repeat;
+    border: 0;
+    border-radius: .375rem;
+    opacity: var(--bs-btn-close-opacity);
+  }
 }
\ No newline at end of file