$excelrivi++; while ($row = mysql_fetch_assoc($saldoresult)) { if ($row["inventointiaika"] == '0000-00-00 00:00:00') { $row["inventointiaika"] = t("Ei inventoitu"); } preg_match("/ \\(([0-9\\.\\-]*?)\\) /", $row["selite"], $invkpl); $vararvo_ennen = round((double) $invkpl[1] * $row["hinta"], 2); $row["selite"] = str_replace("<br>", " ", $row["selite"]); $worksheet->writeString($excelrivi, 0, $row["tuoteno"]); $worksheet->writeString($excelrivi, 1, t_tuotteen_avainsanat($row, 'nimitys')); $worksheet->writeString($excelrivi, 2, $row["toim_tuoteno"]); $worksheet->writeString($excelrivi, 3, $row["hyllyalue"] . " " . $row["hyllynro"] . " " . $row["hyllyvali"] . " " . $row["hyllytaso"]); $worksheet->writeNumber($excelrivi, 4, $row["kpl"]); $worksheet->writeNumber($excelrivi, 5, $row["inventointipoikkeama"]); $worksheet->writeString($excelrivi, 6, t_avainsana("Y", "", "and avainsana.selite='{$row['yksikko']}'", "", "", "selite")); $worksheet->writeDate($excelrivi, 7, $row["inventointiaika"]); $worksheet->writeNumber($excelrivi, 8, $vararvo_ennen); $worksheet->writeNumber($excelrivi, 9, round($row["arvo"], 2)); $worksheet->writeString($excelrivi, 10, $row["selite"]); $excelrivi++; } $excelnimi = $worksheet->close(); echo "<br><br><table>"; echo "<tr><th>" . t("Tallenna Excel") . ":</th>"; echo "<form method='post' class='multisubmit'>"; echo "<input type='hidden' name='tee' value='lataa_tiedosto'>"; echo "<input type='hidden' name='kaunisnimi' value='" . t("Inventointipoikkeamat") . ".xlsx'>"; echo "<input type='hidden' name='tmpfilenimi' value='{$excelnimi}'>"; echo "<td class='back'><input type='submit' value='" . t("Tallenna") . "'></td></tr></form>"; echo "</table><br>"; }
$try = t_avainsana("TRY", '', "and selite = '{$epakurantti_row['try']}'", '', '', "selitetark"); $try_teksti = $try != "" ? "{$epakurantti_row['try']} - {$try}" : $epakurantti_row['try']; if (!$php_cli) { echo "<td>{$try_teksti}</td>"; } $worksheet->writeString($excelrivi, $excelsarake++, $try_teksti); if ($tulorow['laadittu'] == "1970-01-01") { if (!$php_cli) { echo "<td></td>"; } $worksheet->writeString($excelrivi, $excelsarake++, ""); } else { if (!$php_cli) { echo "<td>" . tv1dateconv($tulorow['laadittu']) . "</td>"; } $worksheet->writeDate($excelrivi, $excelsarake++, $tulorow['laadittu']); } if ($laskutusrow['laadittu'] == "1970-01-01") { if (!$php_cli) { echo "<td></td>"; } $worksheet->writeString($excelrivi, $excelsarake++, ""); } else { if (!$php_cli) { echo "<td>" . tv1dateconv($laskutusrow['laadittu']) . "</td>"; } $worksheet->writeDate($excelrivi, $excelsarake++, $laskutusrow['laadittu']); } if ($mikataso == 100) { $ekk = round($epakurtasot_array["100%"] / (365 / 12), 1); } elseif ($mikataso == 75) {
} $excelrivi++; $excelsarake = 0; // Kirjoitetaan rivit foreach ($tuoterivit as $rivi) { $rivi = explode("\t", $rivi); foreach ($rivi as $sarake) { // Poistetaan hipsut sarakkeesta $_sarake = trim($sarake, '"'); // Tämä on string jos sarakkeessa oli hipsut tai sarake on tyhjä $_string = ($_sarake == '' or $_sarake != $sarake); // Katsotaan onko string date $_datetime = date('Y-m-d H:i:s', strtotime($_sarake)) == $_sarake; $_date = date('Y-m-d', strtotime($_sarake)) == $_sarake; if ($_date or $_datetime) { $worksheet->writeDate($excelrivi, $excelsarake++, $_sarake); } elseif ($_string) { $worksheet->writeString($excelrivi, $excelsarake++, $_sarake); } else { $worksheet->writeNumber($excelrivi, $excelsarake++, $_sarake); } } $excelrivi++; $excelsarake = 0; $bar->increase(); //calls the bar with every processed element } // uniikki filenimi $excelnimi = $worksheet->close(); echo "<br><br>"; echo "<form method='post' class='multisubmit'>";