/**
  * Resolve sell price formula data to be exported
  * @param array $data
  */
 public function resolveData(&$data)
 {
     assert('$this->model->{$this->attribute} instanceof SellPriceFormula');
     $sellPriceFormulaModel = $this->model->{$this->attribute};
     $type = $sellPriceFormulaModel->type;
     $discountOrMarkupPercentage = $sellPriceFormulaModel->discountOrMarkupPercentage;
     $displayedSellPriceFormulaList = SellPriceFormula::getDisplayedSellPriceFormulaArray();
     $value = '';
     if ($type != null) {
         $value = $displayedSellPriceFormulaList[$type];
         if ($type != SellPriceFormula::TYPE_EDITABLE) {
             $value = str_replace('{discount}', $discountOrMarkupPercentage / 100, $value);
         }
     }
     $data[$this->model->getAttributeLabel($this->attribute)] = $value;
 }
 /**
  * @return string
  */
 protected function renderControlNonEditable()
 {
     assert('$this->model->{$this->attribute} instanceof SellPriceFormula');
     $sellPriceFormulaModel = $this->model->{$this->attribute};
     $type = $sellPriceFormulaModel->type;
     $discountOrMarkupPercentage = $sellPriceFormulaModel->discountOrMarkupPercentage;
     $displayedSellPriceFormulaList = SellPriceFormula::getDisplayedSellPriceFormulaArray();
     $content = '';
     if ($type != null) {
         $content = $displayedSellPriceFormulaList[$type];
         if ($type != SellPriceFormula::TYPE_EDITABLE) {
             $content = str_replace('{discount}', $discountOrMarkupPercentage . '%', $content);
         }
     }
     return $content;
 }
 /**
  * Get the value of sell price formula displayed in grid view for product template
  * @param RedBeanModel $data
  * @param int $row
  * @return string
  */
 public static function getSellPriceFormulaDisplayedGridValue($data, $row)
 {
     $sellPriceFormulaModel = $data->sellPriceFormula;
     $type = $sellPriceFormulaModel->type;
     $discountOrMarkupPercentage = $sellPriceFormulaModel->discountOrMarkupPercentage;
     $displayedSellPriceFormulaList = SellPriceFormula::getDisplayedSellPriceFormulaArray();
     $content = '';
     if ($type != null) {
         $content = $displayedSellPriceFormulaList[$type];
         if ($type != SellPriceFormula::TYPE_EDITABLE) {
             $content = str_replace('{discount}', $discountOrMarkupPercentage / 100, $content);
         }
     }
     return $content;
 }