Пример #1
0
 $strPayerInfo = '';
 $arPaySystemsListItems = array();
 $companyId = $contactId = 0;
 if ($bMakePayerInfo) {
     // payer information
     $companyId = intval($arFields['UF_COMPANY_ID']);
     $contactId = intval($arFields['UF_CONTACT_ID']);
     CCrmInvoice::__RewritePayerInfo($companyId, $contactId, $arInvoiceProperties);
     $invoicePropsHtmlInputs = CCrmInvoice::__MakePropsHtmlInputs($arInvoiceProperties);
     $strPayerInfo = CCrmInvoice::__MakePayerInfoString($arInvoiceProperties);
     // pay systems
     $arPaySystemsListItems = CCrmPaySystem::GetPaySystemsListItems($personTypeId);
 }
 // recalculate Invoice
 $arFields['ID'] = $bEdit ? $arResult['ELEMENT']['ID'] : 0;
 $arRecalculated = $CCrmInvoice->Recalculate($arFields);
 // product rows to remove
 $arRemoveItems = array();
 if (is_array($arProduct) && count($arProduct) > 0) {
     $arRemoveItems = array_keys($arProduct);
     if (is_array($arRecalculated['BASKET_ITEMS'])) {
         $arKeptItems = array();
         foreach ($arRecalculated['BASKET_ITEMS'] as $row) {
             $arKeptItems[] = intval($row['TABLE_ROW_ID']);
         }
         $arRemoveItems = array_values(array_diff($arRemoveItems, $arKeptItems));
         unset($arKeptItems, $row);
     }
 }
 // response
 $arResponse = array('REMOVE_ITEMS' => $arRemoveItems, 'TAX_VALUE' => isset($arRecalculated['TAX_VALUE']) ? $arRecalculated['TAX_VALUE'] : 0.0, 'PRICE' => isset($arRecalculated['PRICE']) ? $arRecalculated['PRICE'] : 0.0);