private function profileDefault($mode = 'run', $priceType = null)
 {
     if ($mode == 'info') {
         return ['name' => 'Базовый', 'description' => 'Профиль по умолчанию'];
     }
     if ($mode == 'run') {
         $offers = \app\models\Offers::find()->all();
         $arCsv = ['Название;Поставщик;Исходная цена;Посчитанная цена;Количество'];
         $providers = \app\models\Providers::find()->all();
         $arProviders = [];
         foreach ($providers as $value) {
             $arProviders[$value->id] = $value->name;
         }
         foreach ($offers as $offer) {
             $name = \app\components\Goods::getName($offer->goods_id);
             $provider = $arProviders[$offer->providers_id];
             $price = $offer->price;
             $quantity = $offer->quantity;
             //                print $name;
             $calcPrice = $price * \app\components\CalculationDiscount::calc($offer->goods_id, $offer->providers_id, $priceType);
             //                $calcPrice =  \app\components\CalculationDiscount::calc($offer);
             $arCsv[] = "{$name};{$provider};{$price};{$calcPrice};{$quantity}";
         }
         $csv = implode(chr(10), $arCsv);
         $this->_unloadStr('prise.csv', iconv('utf-8', 'windows-1251', $csv));
     }
 }
Exemple #2
0
            <?php 
}
?>
            <th>Кол</th>
            <th>Ц вх</th>
            <th>Ц вых</th>
            <th>Выгода</th>
                
        </tr>
    </thead>
    <tbody>
        <?php 
foreach ($items as $item) {
    ?>
            <?php 
    $newPrice = $item['price'] * \app\components\CalculationDiscount::calc($item['goods_id'], $item['providers_id'], $typePrice);
    $vigoda = $newPrice - $item['price'];
    ?>
            <tr>
                <td><?php 
    echo $arProviders[$item['providers_id']];
    ?>
</td>
                <?php 
    foreach ($arParamsType as $key => $nameParam) {
        ?>
                    <td><?php 
        echo $arrGoodsValues[$item[$key]];
        ?>
</td>
                <?php