static function open_in_blank($kp_id, $client_id, $user_id, $save_on_disk = false) { global $mysqli; // Здесь делаем то что в старой версии делали при сохранении КП в файл // Данные из РТ $multi_dim_arr = self::fetch_kp_rows($kp_id); // echo '<pre>';print_r($multi_dim_arr);echo '</pre>';//exit; /*if(@$_SESSION['access']['user_id']==18){ echo '<pre>';print_r($multi_dim_arr);echo '</pre>'; } */ // Настройки отображения состовляющих КП $display_setting = $multi_dim_arr[key($multi_dim_arr)]['display_setting']; $display_setting_2 = $multi_dim_arr[key($multi_dim_arr)]['display_setting_2']; $dispSetObj = json_decode($display_setting); $itogo = $itogo_print_uslugi = $itogo_extra_uslugi = 0; $itogo_print_uslugi1 = $itogo_print_uslugi2 = $itogo_print_uslugi3 = 0; $itogo_extra_uslugi1 = $itogo_extra_uslugi2 = $itogo_extra_uslugi3 = 0; // echo '<pre>'; // print_r($multi_dim_arr); // echo '</pre>'; // Разворачиваем массив foreach ($multi_dim_arr as $pos_key => $pos_level) { // РАБОТАЕМ С ПЕРВОЙ ЯЧЕЙКОЙ РЯДА ТАБЛИЦЫ КП // в этой ячейке подразумевается отображение картинки товарной позиции // соответсвенное если есть что показывать, то добавляем тег img, если нет то добавляем пустую строку $img_src = 'http://www.apelburg.ru/img/no_image.jpg'; $img_cell = '<img src="' . $img_src . '" height="180" width="180">'; $art_img = new Art_Img_development($pos_key, $pos_level['img_folder'], $pos_level['img'], $pos_level['art']); // $img_src = $art_img->big; // echo '<pre>'; // print_r($art_img); // echo '</pre>'; // меняем размер изображения $img_cell = ''; foreach ($art_img->big as $key => $img_src) { $size_arr = transform_img_size($img_src, 230, 300); // $size_arr = array(230,300); $img_cell .= '<img src="' . $img_src . '" height="' . $size_arr[0] . '" width="' . $size_arr[1] . '">'; } // $img_cell .= '<img src="'.$img_src.'" height="'.$size_arr[0].'" width="'.$size_arr[1].'">'; // $img_cell .= '<img src="'.$img_src.'" height="'.$size_arr[0].'" width="'.$size_arr[1].'">'; // if($pos_level['row_type']=='cat'){ // если позиция из каталога получаем картинку из базы данных каталога // $art_img = new Art_Img($pos_level['art']); // // проверяем наличие изображения // $img_path = 'http://www.apelburg.ru/img/'.$art_img->big; // if($img_src = checkImgExists($img_path)){ // // меняем размер изображения // $size_arr = transform_img_size($img_src,230,300); // // $size_arr = array(230,300); // $img_cell = '<img src="'.$img_src.'" height="'.$size_arr[0].'" width="'.$size_arr[1].'">'; // } // } // РАБОТАЕМ СО ВТОРОЙ ЯЧЕЙКОЙ РЯДА ТАБЛИЦЫ КП // наименование товарной позиции // форматируем вывод, разбиваем строки на куски определенной длины и вставляем перед каждым отступ $str_len = 40; $pos_name = $pos_level['name']; $pos_name = nl2br($pos_name); if ($save_on_disk && isset($dispSetObj->art)) { $article = ''; } else { if ($pos_level['row_type'] != 'cat') { $article = ''; } else { $article = '<managedDisplay name="art" style="display:' . (isset($dispSetObj->art) ? 'none' : 'inline-block') . '">арт.: <a href="/description/' . @$pos_level['art_id'] . '/" target="_blank">' . @$pos_level['art'] . '</a></managedDisplay>'; } } // НАЧИНАЕМ ПЕРЕБИРАТЬ ДАННЫЕ РАСЧЕТОВ // примечание - у позиции может быть любое количество расчетов( а каждый расчет в свою очередь может содержать // любое количество нанесений и доп услуг) foreach ($pos_level['dop_data'] as $r_key => $r_level) { if ($pos_level['row_type'] != 'cat' && isset($r_level['details'])) { $pos_name = $r_level['details']; } $all_print_summ = $all_extra_summ = 0; //$r_ - сокращение обозначающее - уровень Расчёта позиции // стоимост артикула в данном расчете (без нанесения и услуг) // чтобы в дальнейшем не было проблем с делением преобразуем $quantity в 1 если оно равно 0 $quantity = $r_level['quantity'] == 0 ? 1 : $r_level['quantity']; // стоимость $price = $r_level['discount'] != 0 ? round($r_level['price_out'] / 100 * (100 + $r_level['discount']), 2) : $r_level['price_out']; $summ = $quantity * $price; $itogo += $summ; // добавляем данные в содержимое ячейки<td><div contenteditable="true" class="saveKpPosDescription" pos_id="'.$pos_key.'">'.$pos_name.'</div></td> $description_cell = '<div style="margin-top:5px;"><b>Сувенир:</b></div> <table border="0" style="font-family:arial;font-size:13px;" tbl="managed"> <tr> <td style="width:6px;"></td> <td style="width:400px;" managed="text" bd_row_id="' . ($pos_level['row_type'] == 'cat' ? $pos_key : $r_key) . '" bd_field="' . ($pos_level['row_type'] == 'cat' ? 'name' : 'details') . '" action="changeKpPosDescription">' . $pos_name . '</td> </tr> <tr> <td style="width:6px;"></td> <td>' . $article . '</td> </tr> </table>'; if (!($save_on_disk && isset($dispSetObj->sizes))) { $description_cell .= '<managedDisplay name="sizes" style="display:' . (!isset($dispSetObj->sizes) && $r_level['tirage_str'] != '' ? 'inline-block' : 'none') . '"> <table border="0" style="font-family:arial;font-size:13px;" tbl="managed"> <tr> <td style="width:6px;"></td> <td style="width:400px;" managed="text" bd_row_id="' . $r_key . '" action="changeKpPosDescription" bd_field="tirage_str">' . $r_level['tirage_str'] . '</td> </tr> </table> </managedDisplay>'; } if (!($save_on_disk && isset($dispSetObj->characteristics))) { $description_cell .= '<managedDisplay name="characteristics" style="display:' . (!isset($dispSetObj->characteristics) && $pos_level['characteristics'] != '' ? 'inline-block' : 'none') . '"> <table border="0" style="font-family:arial;font-size:13px;" tbl="managed"> <tr> <td style="width:6px;"></td> <td style="width:400px;" managed="text" bd_row_id="' . $pos_key . '" action="changeKpRepresentedData" bd_field="characteristics">' . $pos_level['characteristics'] . '</td> </tr> </table> </managedDisplay>'; } if (!($save_on_disk && isset($dispSetObj->description))) { $description_cell .= '<managedDisplay name="description" style="display:' . (!isset($dispSetObj->description) && $pos_level['description'] != '' ? 'inline-block' : 'none') . '"> <table border="0" style="font-family:arial;font-size:13px;" tbl="managed"> <tr> <td style="width:6px;"></td> <td style="width:400px;" managed="text" bd_row_id="' . $pos_key . '" action="changeKpRepresentedData" bd_field="description">' . $pos_level['description'] . '</td> </tr> </table> </managedDisplay>'; } $description_cell .= '<table style="font-family:arial;font-size:13px;margin-top:10px;width:100%;border-collapse:collapse;width:350px;table-layout:_fixed;" border="0"> <tr> <td align="right" style="width:250px;color:#888;">1шт.</td> <td align="right" style="width:70px;padding:0 5px;"><nobr>' . number_format($price, 2, '.', ' ') . '</nobr></td> <td align="left" style="width:30px;">руб.</td> </tr> <tr> <td align="right" style="color:#888;">тираж: ' . $quantity . ' шт. </td> <td align="right" style="padding:0 5px;"><nobr>' . number_format($summ, 2, '.', ' ') . '</nobr></td> <td align="left">руб.</td> </tr> </table>'; // РАБОТАЕМ С НАНЕСЕНИЯМИ И ДОП УСЛУГАМИ СОБИРАЕМ В ЕДИННЫЕ БЛОКИ ДЛЯ ПОСЛЕДУЮЩЕЙ СБОРКИ $print_block = $details_block = array(); $counter = 0; // если есть нанесение if (isset($r_level['dop_uslugi']['print'])) { $show_count = count($r_level['dop_uslugi']['print']) > 1 ? true : false; $counter2 = 0; foreach ($r_level['dop_uslugi']['print'] as $u_key => $u_level) { if ($u_level['print_details'] == '') { continue; } $print_details_obj = json_decode($u_level['print_details']); if ($print_details_obj == NULL) { continue; } $print_details_arr = json_decode($u_level['print_details'], TRUE); /*if(@$_SESSION['access']['user_id']==18){ echo '<pre>';print_r($print_details_arr);echo '</pre>'; } */ if (isset($print_details_arr['dop_params']['sizes'])) { if ($print_details_arr['dop_params']['sizes'][0]['type'] == 'coeff') { $size_coeff = isset($print_details_arr['dop_params']['sizes'][0]['val']) && $print_details_arr['dop_params']['sizes'][0]['val'] != 0 ? $print_details_arr['dop_params']['sizes'][0]['val'] : 1; } if ($print_details_arr['dop_params']['sizes'][0]['type'] == 'addition') { $size_coeff = isset($print_details_arr['dop_params']['sizes'][0]['val']) ? $print_details_arr['dop_params']['sizes'][0]['val'] : 0; $size_coeff = $print_details_arr['dop_params']['sizes'][0]['target'] == 'summ' ? round($size_coeff / $quantity, 2) : $size_coeff; } } else { $size_coeff = false; } $new_price_arr['price_in'] = $u_level['discount'] != 0 ? $u_level['price_in'] / 100 * (100 + $u_level['discount']) : $u_level['price_in']; $new_price_arr['price_out'] = $u_level['discount'] != 0 ? $u_level['price_out'] / 100 * (100 + $u_level['discount']) : $u_level['price_out']; //$new_price_arr['price_in'] = $u_level['price_in']; //$new_price_arr['price_out'] = $u_level['price_out']; include_once ROOT . "/libs/php/classes/rt_calculators_class.php"; $calculations = rtCalculators::make_calculations($quantity, $new_price_arr, $print_details_obj->dop_params); // echo '<pre>'; print_r($new_price_arr); echo '</pre>'; // /*if(@$_SESSION['access']['user_id']==18){ echo '<pre>';print_r($calculations);echo '</pre>'; } */ // наименование нанесения include_once ROOT . "/libs/php/classes/print_calculators_class.php"; $print_data = printCalculator::convert_print_details_for_kp($u_level['print_details']); /*if(@$_SESSION['access']['user_id']==18){ echo '<pre>';print_r($print_data);echo '</pre>'; } */ // Собираем данные для print_block (Печать логотипа) $print_block[] = '<table border="0" style="font-family:arial;font-size:13px;right;margin:15px 0 0 11px;width:100%;border-collapse:collapse;width:350px;table-layout:fixed;">'; $print_block[] = '<tr><td valign="top" style="width:90px;">метод ' . ($show_count ? ++$counter2 . ': ' : '') . ' </td><td style="width:170px;">' . $print_data['block1']['print_type'] . '</td></tr>'; $print_block[] = '<tr><td valign="top">Место нанесения: </td><td>' . $print_data['block1']['place_type'] . '</td></tr>'; if (isset($print_data['block1']['price_data']['y_params'])) { $print_block[] = '<tr><td valign="top">' . $print_data['block1']['price_data']['cap'] . ': </td><td>' . count($print_data['block1']['price_data']['y_params']) . ' (' . implode(', ', $print_data['block1']['price_data']['y_params']) . ')</td></tr>'; $y_params_count = count($print_data['block1']['price_data']['y_params']); $y_params_coeff = 0; foreach ($print_details_arr['dop_params']['YPriceParam'] as $y_data) { if ($y_data['coeff'] == 0) { $y_data['coeff'] = 1; } $y_params_coeff += $y_data['coeff'] - 1; } } if (isset($print_data['block1']['print_size'])) { // если тип нанесения Тампопечать ( id =18 ) - то тогда не отображаем площать печати if ($u_level['usluga_id'] != 18) { $print_block[] = '<tr><td valign="top">Площадь печати: </td><td>' . $print_data['block1']['print_size'] . '</td></tr>'; } //echo '<pre>--2--'; print_r($print_details_arr['dop_params']); echo '</pre>'; } if (isset($print_data['block2']['data'])) { foreach ($print_data['block2']['data'] as $block2_data) { $print_block[] = '<tr><td valign="top" colspan="2">' . $block2_data['name'] . '</td></tr>'; } } $print_block[] = '</table>'; $print_block_price = $new_price_arr['price_out']; $print_block_price1 = $new_price_arr['price_out']; if ($display_setting_2 == 0) { // вариант 1 // коэффициент площади /*if($size_coeff!==false){ if($print_details_arr['dop_params']['sizes'][0]['type'] == 'coeff'){ $print_block_price = $new_price_arr['price_out']*$size_coeff; } if($print_details_arr['dop_params']['sizes'][0]['type'] == 'addition'){ $print_block_price = $new_price_arr['price_out']+$size_coeff; } } // добавить коэфф цвета если есть if(isset($y_params_count) && $y_params_count>0){ $y_params_coeff = (isset($y_params_coeff))?$y_params_coeff:1; $print_block_price += ($new_price_arr['price_out']/$y_params_count)*$y_params_coeff; }*/ $print_block_summ = $quantity * $print_block_price; $all_print_summ += $quantity * $new_price_arr['price_out']; $itogo_print_uslugi += $print_block_summ; //$itogo_extra_uslugi += $calculations['new_summs']['summ_out'] - $print_block_summ; } else { if ($display_setting_2 == 1) { // вариант 2 $print_block_price = $new_price_arr['price_out']; $print_block_summ = $quantity * $new_price_arr['price_out']; $all_print_summ += $calculations['new_summs']['summ_out']; $itogo_print_uslugi += $print_block_summ; //$itogo_extra_uslugi += $calculations['new_summs']['summ_out'] - $print_block_summ; } else { if ($display_setting_2 == 2) { // вариант 3 $print_block_price = $new_price_arr['price_out']; $print_block_summ = $quantity * $new_price_arr['price_out']; $all_print_summ += $calculations['new_summs']['summ_out']; $itogo_print_uslugi += $calculations['new_summs']['summ_out']; } } } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // коэффициент площади /*if($size_coeff!==false){ if($print_details_arr['dop_params']['sizes'][0]['type'] == 'coeff'){ $print_block_price1 = $new_price_arr['price_out']*$size_coeff; } if($print_details_arr['dop_params']['sizes'][0]['type'] == 'addition'){ $print_block_price1 = $new_price_arr['price_out']+$size_coeff; } } //$size_coeff = (isset($size_coeff))?$size_coeff:1; //$print_block_price1 = $new_price_arr['price_out']*$size_coeff; // добавить коэфф цвета если есть if(isset($y_params_count) && $y_params_count>0){ $y_params_coeff = (isset($y_params_coeff))?$y_params_coeff:1; $print_block_price1 += ($new_price_arr['price_out']/$y_params_count)*$y_params_coeff; }*/ $print_block_summ1 = $quantity * $print_block_price1; $itogo_print_uslugi1 += $quantity * $print_block_price1; //$itogo_extra_uslugi1 += $calculations['new_summs']['summ_out'] - $print_block_summ1; $print_block_price2 = $new_price_arr['price_out']; $print_block_summ2 = $quantity * $new_price_arr['price_out']; $itogo_print_uslugi2 += $quantity * $new_price_arr['price_out']; // $itogo_extra_uslugi2 += $calculations['new_summs']['summ_out'] - $quantity*$new_price_arr['price_out']; $print_block_price3 = $new_price_arr['price_out']; $print_block_summ3 = $quantity * $new_price_arr['price_out']; //$itogo_print_uslugi3 += $calculations['new_summs']['summ_out']; ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// unset($size_coeff); unset($y_params_coeff); unset($y_params_count); if ($save_on_disk && isset($dispSetObj->full_summ)) { $print_block[] = '<table style="font-family:arial;font-size:13px;right;margin:0 0 5px 0;width:100%;border-collapse:collapse;width:350px;table-layout:_fixed;" border="0"> <tr> <td align="right" style="width:250px;color:#888;">1шт.</td> <td align="right" style="width:70px;padding:0 5px;"><nobr>' . number_format($print_block_price, 2, '.', ' ') . '</nobr></td> <td align="left" style="width:30px;">руб.</td> </tr> <tr> <td align="right" style="color:#888;">тираж: ' . $quantity . ' шт. </td> <td align="right" style="padding:0 5px;"><nobr>' . number_format($print_block_summ, 2, '.', ' ') . '</nobr></td> <td align="left">руб.</td> </tr> </table>'; } else { $print_block[] = '<table style="font-family:arial;font-size:13px;right;margin:0 0 5px 0;width:100%;border-collapse:collapse;width:350px;table-layout:_fixed;" border="0"> <tr> <td align="right" style="width:250px;color:#888;">1шт.</td> <td align="right" style="width:70px;padding:0 5px;"><nobr><span id="metod_display_setting_' . $counter2 . '1_0" style="display:' . ($display_setting_2 == 0 ? 'inline-block' : 'none') . '">' . number_format($print_block_price1, 2, ',', ' ') . '</span><span id="metod_display_setting_' . $counter2 . '1_1" style="display:' . ($display_setting_2 == 1 ? 'inline-block' : 'none') . '">' . number_format($print_block_price2, 2, ',', ' ') . '</span><span id="metod_display_setting_' . $counter2 . '1_2" style="display:' . ($display_setting_2 == 2 ? 'inline-block' : 'none') . '">' . number_format($print_block_price3, 2, ',', ' ') . '</span></nobr></td> <td align="left" style="width:30px;">руб.</td> </tr> <tr> <td align="right" style="color:#888;">тираж: ' . $quantity . ' шт. </td> <td align="right" style="padding:0 5px;"><nobr><span id="metod_display_setting_' . $counter2 . '2_0" style="display:' . ($display_setting_2 == 0 ? 'inline-block' : 'none') . '">' . number_format($print_block_summ1, 2, ',', ' ') . '</span><span id="metod_display_setting_' . $counter2 . '2_1" style="display:' . ($display_setting_2 == 1 ? 'inline-block' : 'none') . '">' . number_format($print_block_summ2, 2, ',', ' ') . '</span><span id="metod_display_setting_' . $counter2 . '2_2" style="display:' . ($display_setting_2 == 2 ? 'inline-block' : 'none') . '">' . number_format($print_block_summ3, 2, ',', ' ') . '</span></nobr></td> <td align="left">руб.</td> </tr> </table>'; } unset($print_block_summ); unset($print_block_price); unset($print_block_price3); // Собираем данные для details_block (деталировка по нанесению) $square_coeff = 1; //echo '<pre>--1--'; print_r( $print_data['block1']['price_data']['y_params']); echo '</pre>'; //echo '<pre>--2--'; print_r( $print_details_arr['dop_params']); echo '</pre>'; foreach ($print_details_arr['dop_params'] as $type => $data) { $price_addition = $summ_addition = 0; // if ($type == 'sizes' && isset($data[0]['val'])) { // в итгое не выводится первым потому что в исходном массиве не на первом месте if ($data[0]['val'] == 0) { $data[0]['val'] = 1; } if ($data[0]['target'] == 'price') { $square_coeff = $data[0]['val']; } //!!if($data->target == 'summ') $summ_coeff += (float)$data->val-1; if ($square_coeff == 1) { continue; } $print_summ = $quantity * ($new_price_arr['price_out'] * ($square_coeff - 1)); if ($save_on_disk && $display_setting_2 != 0) { $rows_2[] = '<tr><td align="left" style="width:230px;padding:0 5px 0 15px;">+ ' . ($square_coeff - 1) * 100 . '% за увелич. площади печати</td>'; $rows_2[] = '<td align="right" style="width:90px;">' . number_format($print_summ, 2, '.', ' ') . '</td>'; $rows_2[] = '<td align="left" style="width:30px;">руб. </td></tr>'; /**/ } else { if (!$save_on_disk) { $rows_2[] = '<tr id="metod_display_setting_' . $counter2 . '3" style="display:' . ($display_setting_2 != 0 ? 'table-row' : 'none') . '"><td align="left" style="width:230px;padding:0 5px 0 15px;">+ ' . ($square_coeff - 1) * 100 . '% за увелич. площади печати</td>'; $rows_2[] = '<td align="right" style="width:90px;">' . number_format($print_summ, 2, '.', ' ') . '</td>'; $rows_2[] = '<td align="left" style="width:30px;">руб. </td></tr>'; /**/ } } } if ($type == 'YPriceParam') { $price_tblYindex = count($data) == 0 ? 1 : count($data); $base_price_for_Y = $new_price_arr['price_out'] / $price_tblYindex; foreach ($data as $index => $Y_data) { if ($Y_data['coeff'] == 1) { continue; } $Y_coeff = (double) $Y_data['coeff'] - 1; $print_summ = $quantity * ($base_price_for_Y * $Y_coeff); if ($save_on_disk && $display_setting_2 != 0) { $rows_2[] = '<tr><td align="left" style="width:230px;padding:0 5px 0 15px;">+ ' . ($Y_data['coeff'] - 1) * 100 . '% за металлик (' . $print_data['block1']['price_data']['y_params_ids'][$Y_data['id']] . ')</td>'; $rows_2[] = '<td align="right" style="width:90px;">' . number_format($print_summ, 2, '.', ' ') . '</td>'; $rows_2[] = '<td align="left" style="width:30px;">руб. </td></tr>'; } else { if (!$save_on_disk) { $rows_2[] = '<tr id="metod_display_setting_' . $counter2 . $index . '4" style="display:' . ($display_setting_2 != 0 ? 'table-row' : 'none') . '"><td align="left" style="width:230px;padding:0 5px 0 15px;">+ ' . ($Y_data['coeff'] - 1) * 100 . '% за металлик (' . $print_data['block1']['price_data']['y_params_ids'][$Y_data['id']] . ')</td>'; $rows_2[] = '<td align="right" style="width:90px;">' . number_format($print_summ, 2, '.', ' ') . '</td>'; $rows_2[] = '<td align="left" style="width:30px;">руб. </td></tr>'; } } } } } $base_price2 = $new_price_arr['price_out'] * $square_coeff; $spechial_summ = 100; foreach ($print_data['block2'] as $data) { foreach ($data as $data2) { if ($data2['type'] == 'coeff') { if ($data2['value'] == 1) { continue; } $spechial_summ = 1; $coeff = $data2['value'] - 1; $print_summ = $data2['target'] == 'price' ? $quantity * ($base_price2 * $coeff) : $spechial_summ / 100 * $data2['value']; } if ($data2['type'] == 'addition') { if ($data2['value'] == 0) { continue; } $print_summ = $data2['target'] == 'price' ? $quantity * $data2['value'] : $data2['value']; } $rows_2[] = '<tr><td align="left" style="width:230px;padding:0 5px 0 15px;">' . $data2['name'] . '</td>'; $rows_2[] = '<td align="right" style="width:90px;">' . number_format($print_summ, 2, '.', ' ') . '</td>'; $rows_2[] = '<td align="left" style="width:30px;">руб. </td></tr>'; } } if (isset($rows_2)) { //$details_block11[$counter]['cap'] = 'для метода печати '.(($show_count)? $counter2.': ':''); //$details_block11[$counter]['data'] = $rows_2; } $counter++; // echo '<pre>'; print_r($rows_2); echo '</pre>'; unset($rows_2); // //echo '<table style="margin-top:5px;border-collapse:collapse;" border="1">'.implode('',$rows_2).'</table>'; } } // перебор доп услуг if (isset($r_level['dop_uslugi']['extra'])) { foreach ($r_level['dop_uslugi']['extra'] as $u_key => $u_level) { if ($u_level['price_out'] == 0) { continue; } include_once ROOT . "/libs/php/classes/agreement_class.php"; // если альтернативное название отсутствует (вводится при заведении услуги "НЕТ В СПИСКЕ") if (trim($u_level['other_name']) == "") { $extra_usluga_details = Agreement::get_usluga_details($u_level['usluga_id']); $u_level['name'] = $extra_usluga_details ? $extra_usluga_details['name'] : 'Неопределено'; } else { $u_level['name'] = $u_level['other_name']; } $print_summ = $u_level['for_how'] == 'for_all' ? $u_level['price_out'] : $quantity * $u_level['price_out']; $all_extra_summ += $print_summ; $itogo_extra_uslugi += $print_summ; $itogo_extra_uslugi1 += $print_summ; $itogo_extra_uslugi2 += $print_summ; $itogo_extra_uslugi3 += $print_summ; $rows_2[] = '<tr><td align="left" style="width:230px;height:10px;line-height:10px;padding:0 5px 0 15px;">' . $u_level['name'] . '</td>'; $rows_2[] = '<td align="right" style="width:90px;">' . number_format($print_summ, 2, '.', ' ') . '</td>'; $rows_2[] = '<td align="left" style="width:30px;">руб. </td></tr>'; } if (isset($rows_2)) { $details_block11[$counter]['cap'] = 'для сувенира '; $details_block11[$counter]['data'] = $rows_2; } unset($rows_2); } // Вставляем блоки в тело КП if (isset($print_block) && count($print_block) > 0) { $description_cell .= '<hr style="border:none;border-top:#888 solid 1px;"><div style="margin-top:5px;"><b>Печать логотипа:</b></div>'; $description_cell .= '<div style="">' . implode('<div></div>', $print_block) . '</div>'; } if (isset($details_block11) && count($details_block11) > 0) { /*if(true!($save_on_disk && isset($dispSetObj->dop_uslugi))){ //style="display:'.(isset($dispSetObj->dop_uslugi)?'none':'block').'}"*/ $description_cell .= '<managedDisplay name="dop_uslugi" style="display:' . (isset($dispSetObj->dop_uslugi) ? 'none' : 'block') . '"><hr style="border:none;border-top:#888 solid 1px;"><div><b>Дополнительные услуги:</b></div>'; $description_cell .= '<table style="margin-top:5px;border-collapse:collapse; font-family:arial;font-size:13px;" border="0">'; foreach ($details_block11 as $key => $rows) { //$description_cell .= '<tr><td align="left" height="25" colspan="3" style="padding:0 5px 0 15px;color:#888">'.$rows['cap'].'</td>'; $description_cell .= implode('', $rows['data']); } $description_cell .= '</table></managedDisplay>'; } $description_cell .= '<table style="margin:5px 0 10px 0;border-collapse:collapse;" border="0"><tr><td align="left" style="width:220px;"><b>Итого</b></td>'; /*if(@$_SESSION['access']['user_id']==18){ echo '---'.$summ.'--'.$all_print_summ.'--'.$all_extra_summ.'---'; } */ $description_cell .= '<td align="right" style="width:100px;"><b>' . number_format($summ + $all_print_summ + $all_extra_summ, 2, '.', ' ') . '</b></td>'; $description_cell .= '<td align="left" style="width:30px;"><b>руб.</b></td></tr></table>'; $tbl_rows[] = '<tr><td style="border-bottom:#91B73F solid 2px; border-top:#91B73F solid 2px;" width="300" valign="middle" align="center">' . $img_cell . '</td><td style="border-bottom:#91B73F solid 2px; border-top:#91B73F solid 2px;padding:6px;" width="325" valign="top">' . $description_cell . '</td></tr>'; $description_cell = $print_description = ''; unset($details_block11); unset($print_details); unset($extra_details); unset($pos_and_print_cost); } } /******************** ++++++++++++++ *********************/ // КОНЕЧНАЯ СБОРКА КП // Данные для шапки $cont_face_data_arr = get_client_cont_face_by_id($client_id, $user_id, true); $client_data_arr = select_all_client_data($client_id); // получаем данные о получателе КП, сначала вычисляем его id // потом передаем его в метод Client::get_cont_face_details($recipient_id); reset($multi_dim_arr); $recipient_id = $multi_dim_arr[key($multi_dim_arr)]['recipient_id']; include_once ROOT . "/libs/php/classes/client_class.php"; $cont_face_data = Client::get_cont_face_details($recipient_id); //print_r($cont_face_data_arr);//exit;625 $kp_content = '<div id="kpBlankConteiner" style="width:675px;background-color:#FFFFFF;border:#91B73F solid 0px;"><table width="675" style="border-collapse:collapse;background-color:#FFFFFF;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;" valign="top"><tr><td colspan="2" style="text-align:right;"> <input type="hidden" style="width:90px;" id="kpDisplaySettings" value=' . $display_setting . '><input type="hidden" id="kpDisplaySettings_kpId" value=' . $kp_id . '>'; if (!($save_on_disk && isset($dispSetObj->header))) { $kp_content .= '<div style="text-align:right;font-family:verdana;font-size:12px;font-weight:bold;line-height:16px;"><managedDisplay name="header" style="display:' . (isset($dispSetObj->header) ? 'none' : 'block') . '">В компанию: ' . Client::get_client_name($client_id) . '<br />Кому: ' . $cont_face_data['last_name'] . ' ' . $cont_face_data['name'] . ' ' . $cont_face_data['surname'] . '</managedDisplay></div>'; } //s$kp_content .= '<div style="font-family:verdana;font-size:18px;padding:10px;color:#10B050;text-align:center;border:#91B73F solid 1px;width:675px;">Презентация</div>'; $kp_content .= '</td></tr> <tr><td colspan="2" style="text-align:center;"> <div style="font-family:verdana; font-size:18px;padding:10px;color:#10B050;">Презентация</div></td></tr>'; $kp_content .= '</td></tr>' . implode('', $tbl_rows) . '<tr><td colspan="2" style="text-align:right;">'; // <div style="border-top:#91B73F solid 2px;width:675px;"></div> /******************** ++++++++++++++ *********************/ if ($save_on_disk && !isset($dispSetObj->full_summ)) { if ($itogo != 0) { $full_itog = $itogo + $itogo_print_uslugi + $itogo_extra_uslugi; $kp_content .= '<div style="text-align:right;"> <managedDisplay name="full_summ" style="text-align:right;display:' . (isset($dispSetObj->full_summ) ? 'none' : 'inline-block') . '"> <table align="right" style="margin:15px 0px 10px 0;font-family:arial" border="0">'; if ($itogo_print_uslugi + $itogo_extra_uslugi != 0) { $kp_content .= '<tr> <td width="230" height="20" align="right" valign="top" style="padding-right:2px;" >Общая стоимость сувениров:</td><td width="150" align="right" valign="top">' . number_format($itogo, 2, ',', ' ') . 'руб.</td> </tr>'; } if ($itogo_print_uslugi != 0) { $kp_content .= '<tr> <td align="right" height="20" valign="top">Общая стоимость нанесения:</td><td align="right" valign="top">' . number_format($itogo_print_uslugi, 2, ',', ' ') . 'руб.</td> </tr>'; } if ($itogo_extra_uslugi != 0) { $kp_content .= '<tr> <td align="right" height="30" valign="top">Общая стоимость доп услуг:</td><td align="right" valign="top">' . number_format($itogo_extra_uslugi, 2, ',', ' ') . 'руб.</td> </tr>'; } $kp_content .= '<tr> <td align="right" valign="top" style="font-family:verdana;font-size:14px;font-weight:bold;">Итоговая сумма:</td><td align="right" valign="top" style="font-family:verdana;font-size:14px;font-weight:bold;white-space: nowrap">' . number_format($full_itog, 2, ',', ' ') . 'руб.</td> </tr> </table> </managedDisplay>'; } } else { if (!$save_on_disk) { if ($itogo != 0) { $full_itog = $itogo + $itogo_print_uslugi + $itogo_extra_uslugi; $kp_content .= '<div style="text-align:right;"> <managedDisplay name="full_summ" style="text-align:right;display:' . (isset($dispSetObj->full_summ) ? 'none' : 'inline-block') . '"> <table align="right" style="margin:15px 0px 10px 0;font-family:arial" border="0">'; if ($itogo_print_uslugi + $itogo_extra_uslugi != 0) { $kp_content .= '<tr> <td width="230" height="20" align="right" valign="top" style="padding-right:2px;" >Общая стоимость сувениров:</td><td width="150" align="right" valign="top">' . number_format($itogo, 2, ',', ' ') . 'руб.</td> </tr>'; } if ($itogo_print_uslugi != 0) { $kp_content .= '<tr> <td align="right" height="20" valign="top">Общая стоимость нанесения:</td><td align="right" valign="top"><span id="itogo_display_setting_1_0" style="display:' . ($display_setting_2 == 0 ? 'inline-block' : 'none') . '">' . number_format($itogo_print_uslugi1, 2, ',', ' ') . '</span><span id="itogo_display_setting_1_1" style="display:' . ($display_setting_2 == 1 ? 'inline-block' : 'none') . '">' . number_format($itogo_print_uslugi2, 2, ',', ' ') . '</span><span id="itogo_display_setting_1_2" style="display:' . ($display_setting_2 == 2 ? 'inline-block' : 'none') . '">' . number_format($itogo_print_uslugi3, 2, ',', ' ') . '</span>руб.</td> </tr>'; } if ($itogo_extra_uslugi != 0) { $kp_content .= '<tr> <td align="right" height="30" valign="top">Общая стоимость доп услуг:</td><td align="right" valign="top"><span id="itogo_display_setting_2_0" style="display:' . ($display_setting_2 == 0 ? 'inline-block' : 'none') . '">' . number_format($itogo_extra_uslugi1, 2, ',', ' ') . '</span><span id="itogo_display_setting_2_1" style="display:' . ($display_setting_2 == 1 ? 'inline-block' : 'none') . '">' . number_format($itogo_extra_uslugi2, 2, ',', ' ') . '</span><span id="itogo_display_setting_2_2" style="display:' . ($display_setting_2 == 2 ? 'inline-block' : 'none') . '">' . number_format($itogo_extra_uslugi3, 2, ',', ' ') . '</span>руб.</td> </tr>'; } $kp_content .= '<tr style="font-family:verdana;font-size:14px;font-weight:bold;"> <td align="right" valign="top">Итоговая сумма:</td><td align="right" valign="top" style="white-space: nowrap">' . number_format($full_itog, 2, ',', ' ') . 'руб.</td> </tr> </table> </managedDisplay>'; } } } $kp_content .= '<div style="text-align:right;font-family:arial;font-size:12px;line-height:20px;"><br>' . convert_bb_tags(mysql_result(select_manager_data($user_id), 0, 'mail_signature')) . '<br><br><br></div>'; $kp_content .= '<div style="text-align:justify;font-family:verdana;font-size:10px;line-height:11px;padding:0 20px;"><br>Данная презентация носит исключительно информационный характер и никакая информация, опубликованная в ней, ни при каких условиях не является офертой или публичной офертой, определяемой положениями пункта 2 статьи 437 и статьи 435 Гражданского кодекса Российской Федерации. Для получения подробной информации о реализуемых товарах, работах и услугах и их цене необходимо обращаться к менеджерам компании Апельбург<br><br><br></div></td></tr></table></div>'; return $kp_content; }