goto tjULq; mYOhX: if ($_POST) { $phpWord = new \PhpOffice\PhpWord\PhpWord(); $sectionStyle = array("orientation" => "landscape", "marginLeft" => 600, "headerHeight" => 710, "marginRight" => 600, "borderBottomColor" => "ffffff"); $section = $phpWord->addSection($sectionStyle); $fontStyle = array("name" => "Times New Roman", "size" => 14, "bold" => TRUE); $parStyle = array("align" => "center", "spaceBefore" => 0, "spaceAfter" => 0); $section->addText("Расчет выбросов загрязняющих веществ", $fontStyle, $parStyle); $section->addText("при зарядке аккумуляторных батарей", $fontStyle, $parStyle); $section->addText('', $fontStyle, array("align" => "center")); $section->addText($_POST["name_form"], $fontStyle, array("align" => "center")); $header = array("name" => "Times New Roman", "size" => 12, "align" => "center"); $parStyle = array("align" => "left", "spaceBefore" => 0, "spaceAfter" => "auto", "lineHeight" => 1); $section->addText("Количественная и качественная характеристика загрязняющих веществ, выделяющихся в атмосферу при проведении операций по обслуживанию аккумуляторных батарей, приведена в таблице.", $header, $parStyle); $sumk = false; $sumch = false; $row10 = array("Код ЗВ", "Наименование ЗВ", "Максимально разовый выброс, г/с", "Годовой выброс, т/год"); $row11 = array("00", "Натрий гидрооксид", 0, 0); $row12 = array("02", "Серная кислота", 0, 0); $row0 = array("№", "Наименование", "Тип АКБ", "Емкость аккумуляторной батареи (Q, А × ч)", "Удельное выделение, q, мг/(А*ч)", "Количество зарядок в год (a)", "Количество одновременно заряжаемых аккумуляторов (n')", "Цикл проведения зарядки в день (m, час)", "Одновременность", "Максимально разовый выброс,
г/с", "Валовый выброс, т/г"); $all_row = array(); array_push($all_row, $row0); for ($p = 1; $p <= count($_POST) / 7; $p++) { $max_release = $_POST["type_{$p}"] * floatval(str_replace(",", , $_POST["capacity_Q_{$p}"])) * $_POST["quantity_charge_{$p}"] * pow(10, -9) * 0.9 * pow(10, 6) / ($_POST["while_{$p}"] * 3600); $gross_release = $_POST["type_{$p}"] * $_POST["capacity_a_{$p}"] * floatval(str_replace(",", , $_POST["capacity_Q_{$p}"])) * pow(10, -9) * 0.9; if ($_POST["type_{$p}"] == "1") { $type = "Кислотный"; if ($sumk === true) { if ($_POST["radioitem_{$p}"] == "Да") { $row12 = array("22", "Серная кислота", $row12[2] + $max_release, $row12[3] + $gross_release); } else { $row12 = array("03", "Серная кислота", $row12[2], $row12[3] + $gross_release); } } else { if ($_POST["radioitem_{$p}"] == "Да") { if ($_POST["radioitem_" . ($p - 1)] == "Нет") { $row12[2] = 0; } $sumk = true; $row12 = array("0322", "Серная кислота", $row12[2] + $max_release, $row12[3] + $gross_release); } else { if ($max_release > $row12[2]) { $row12 = array("02", "Серная кислота", $max_release, $row12[3] + $gross_release); } else { $row12 = array("03", "Серная кислота", $row12[2], $row12[3] + $gross_release); } } } } else { $type = "Щелочной"; if ($sumch === TRUE) { if ($_POST["radioitem_{$p}"] == "Да") { $row11 = array("0150", "Натрий гидрооксид", $row11[2] + $max_release, $row11[3] + $gross_release); } else { $row11 = array("00", "Натрий гидрооксид", $row11[2], $row11[3] + $gross_release); } } else { if ($_POST["radioitem_{$p}"] == "Да") { if ($_POST["radioitem_#{ii}"] == "Нет") { $row11[2] = 0; } $sumch = true; $row11 = array("0150", "Натрий гидрооксид", $row11[2] + $max_release, $row11[3] + $gross_release); } else { if ($max_release > $row11[2]) { $row11 = array("0150", "Натрий гидрооксид", $max_release, $row11[3] + $gross_release); } else { $row11 = array("00", "Натрий гидрооксид", $row11[2], $row11[3] + $gross_release); } } } } $max_release = cut_number($max_release, 7); $gross_release = cut_number($gross_release, 6); array_push($all_row, array($p, $_POST["name_{$p}"], $type, floatval(str_replace(",", , $_POST["capacity_Q_{$p}"])), $_POST["type_{$p}"], $_POST["capacity_a_{$p}"], $_POST["quantity_charge_{$p}"], $_POST["while_{$p}"], $_POST["radioitem_{$p}"], $max_release, $gross_release)); } $tableStyle = array("borderSize" => 6, "borderColor" => "0000", "align" => "center"); $phpWord->addTableStyle("myTable", $tableStyle); $styleCell = array("valign" => "center"); $table = $section->addTable("myTable"); $table->addRow(); $table->addCell(1250, $styleCell)->addText($row10[0], array("name" => "Times New Roman", "size" => 12, "bold" => true, "align" => "center")); $table->addCell(2800, $styleCell)->addText($row10[1], array("name" => "Times New Roman", "size" => 12, "bold" => true, "align" => "center")); $table->addCell(6000, $styleCell)->addText($row10[2], array("name" => "Times New Roman", "size" => 12, "bold" => true, "align" => "center")); $table->addCell(5000, $styleCell)->addText($row10[3], array("name" => "Times New Roman", "size" => 12, "bold" => true, "align" => "center")); $pTextStyle = array("name" => "Times New Roman", "size" => 12, "align" => "center"); if ($row11[2] != 0) { $table->addRow(); $table->addCell(1250, $styleCell)->addText($row11[0], $pTextStyle); $table->addCell(2800, $styleCell)->addText($row11[1], $pTextStyle); $table->addCell(6000, $styleCell)->addText(cut_number($row11[2], 7), $pTextStyle); $table->addCell(5000, $styleCell)->addText(cut_number($row11[3], 6), $pTextStyle); } if ($row12[2] != 0) { $table->addRow(); $table->addCell(1250, $styleCell)->addText($row12[0], $pTextStyle); $table->addCell(2800, $styleCell)->addText($row12[1], $pTextStyle); $table->addCell(6000, $styleCell)->addText(cut_number($row12[2], 7), $pTextStyle); $table->addCell(5000, $styleCell)->addText(cut_number($row12[3], 6), $pTextStyle); } $parStyle = array("align" => "left", "spaceBefore" => 160, "spaceAfter" => 160); $section->addText("Исходные данные и расчет приведены в таблице:", $header, $parStyle); $phpWord->addTableStyle($spanTableStyleName, $fancyTableStyle); $table = $section->addTable("myTable"); $table->addRow(); $table->addCell(400)->addText($all_row[0][0], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][1], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][2], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][3], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][4], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][5], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][6], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][7], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][8], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][9], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText($all_row[0][10], array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addRow(); $table->addCell(400)->addText("1", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("2", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("3", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("4", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("5", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("6", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("7", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("8", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("9", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("", array("name" => "Times New Roman", "size" => 12, "bold" => true)); $table->addCell(1505)->addText("", array("name" => "Times New Roman", "size" => 12, "bold" => true)); for ($r = 1; $r < count($all_row); $r++) { $table->addRow(); for ($c = 0; $c <= 10; $c++) { $table->addCell(1505)->addText($all_row[$r][$c], array("name" => "Times New Roman", "size" => 12)); } } require_once $_SERVER["DOCUMENT_ROOT"] . "/wp-load.php"; global $current_user; update_user_meta($current_user->ID, "air_form_download", intval(get_user_meta($current_user->ID, "air_form_download", true)) + 1); $name = "Таблица_расчетов_по_маркам_аккумуляторов_" . date("h-i-s_j-m-Y") . ".docx"; $saveName = dirname(__FILE__) . "/download/" . $name; $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, "Word2007"); $objWriter->save($saveName); echo "/wp-content/themes/caer/forms/1/download/" . $name; } goto YJ1Km; RU0tF: ini_set("display_startup_errors", 0); goto jeoyU; akXXs: ini_set("display_errors", 0); goto RU0tF; tjULq: ini_set("error_reporting", false); goto akXXs; YJ1Km: function cut_number($val, $precision) { if (stripos($val, "E") != false) { $explode = explode("E-", $val); $explode = $explode[1]; if ($explode < $precision) { $res = number_format($val, $precision); } else { $res = number_format($val, $explode); } } else { $res = number_format($val, $precision); } return $res; } goto lxLwa; jeoyU: require "vendor/autoload.php"; goto mYOhX; lxLwa:
© 2023 Quttera Ltd. All rights reserved.