]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-381] inputed cost 6
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 26 Mar 2025 14:38:57 +0000 (17:38 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 26 Mar 2025 14:38:57 +0000 (17:38 +0300)
erp24/controllers/BouquetController.php
erp24/records/BouquetComposition.php

index 40862fc60c4b90ca0c35da28172a8ec70db8449f..faf4a9a8a6c0fc28cdec79516537598c9b27d8bb 100644 (file)
@@ -150,7 +150,7 @@ class BouquetController extends Controller
 
         return [
             'selfcost' => round($model->getSelfCost($data), 2),
-            'cost' => round($model->getBouquetCost($data), 2),
+            'cost' => round($model->getBouquetCost($data, true), 2),
             'markup' => round($model->getBouquetCostMarkup($data), 2),
         ];
     }
index 2ae35c57401901dd247a97901b102780ca12df43..4bb20efa93e0bc27ce5c1e2ffa89f36ad12dba60 100644 (file)
@@ -373,13 +373,13 @@ class BouquetComposition extends ActiveRecord
         $newPriceDynamic->save();
     }
 
-    public function getBouquetCost($data = null) {
+    public function getBouquetCost($data = null, $forceDefault = false) {
         $priceModel = PricesDynamic::find()
             ->where(['product_id' => $this->guid])
             ->andWhere(['=', 'active', PricesDynamic::ACTIVE])
             ->one();
         /* @var PricesDynamic $priceModel */
-        return $priceModel ? $priceModel->price : $this->getSelfCost($data) * 1.3 * 1.15;
+        return $priceModel && !$forceDefault ? $priceModel->price : $this->getSelfCost($data) * 1.3 * 1.15;
     }
 
     public function getBouquetCostMarkup($data = null) {