Example #1
0
<td><?php 
                    echo CCrmProductRow::GetPrice($productRow, '');
                    ?>
</td><?php 
                    ?>
<td><?php 
                    echo CCrmProductRow::GetQuantity($productRow, '');
                    ?>
</td><?php 
                    continue;
                } elseif ($headerID === 'OPPORTUNITY') {
                    // Special logic for OPPORTUNITY: replace it by product row sum if it specified
                    if (isset($productRow['PRODUCT_ID']) && intval($productRow['PRODUCT_ID']) > 0) {
                        ?>
<td><?php 
                        echo round(CCrmProductRow::GetPrice($productRow) * CCrmProductRow::GetQuantity($productRow), 2);
                        ?>
</td><?php 
                    } else {
                        ?>
<td><?php 
                        echo isset($arDeal['OPPORTUNITY']) ? strval($arDeal['OPPORTUNITY']) : '';
                        ?>
</td><?php 
                    }
                    continue;
                }
                if (!isset($dealData[$headerID])) {
                    switch ($arHead['id']) {
                        case 'STAGE_ID':
                            $stageID = !empty($arDeal['STAGE_ID']) ? $arDeal['STAGE_ID'] : '';
Example #2
0
 foreach ($arResult['SELECTED_HEADERS'] as $headerID) {
     $arHead = isset($arHeaders[$headerID]) ? $arHeaders[$headerID] : null;
     if (!$arHead) {
         continue;
     }
     $headerID = $arHead['id'];
     if ($headerID === 'PRODUCT_ID') {
         // Special logic for PRODUCT_ROWS: expand product in 3 columns
         echo '"', isset($productRow['PRODUCT_NAME']) ? str_replace('"', '""', $productRow['PRODUCT_NAME']) : '', '";';
         echo '"', CCrmProductRow::GetPrice($productRow, ''), '";';
         echo '"', CCrmProductRow::GetQuantity($productRow, ''), '";';
         continue;
     } elseif ($headerID === 'OPPORTUNITY') {
         // Special logic for OPPORTUNITY: replace it by product row sum if it specified
         if (isset($productRow['PRODUCT_ID']) && intval($productRow['PRODUCT_ID']) > 0) {
             echo '"', round(CCrmProductRow::GetPrice($productRow) * CCrmProductRow::GetQuantity($productRow), 2), '";';
         } else {
             echo '"', isset($arLead['OPPORTUNITY']) ? strval($arLead['OPPORTUNITY']) : '', '";';
         }
         continue;
     }
     if (!isset($leadData[$headerID])) {
         switch ($headerID) {
             case 'STATUS_ID':
                 $statusID = !empty($arLead['STATUS_ID']) ? $arLead['STATUS_ID'] : '';
                 $leadData['STATUS_ID'] = isset($arResult['STATUS_LIST'][$statusID]) ? $arResult['STATUS_LIST'][$statusID] : $statusID;
                 break;
             case 'SOURCE_ID':
                 $sourceID = !empty($arLead['SOURCE_ID']) ? $arLead['SOURCE_ID'] : '';
                 $leadData['SOURCE_ID'] = isset($arResult['SOURCE_LIST'][$sourceID]) ? $arResult['SOURCE_LIST'][$sourceID] : $sourceID;
                 break;