Example #1
0
 } elseif ($raportti == "24") {
     $rivinpituus_ps = 28;
     $rivinpituus = 27;
     $sarakkeet = 3;
     $rivit = 8;
     if ($as_yht_tiedot == 'on' or $asiakas_segmentin_yhteystiedot == 'on') {
         $sisalto .= "\n";
         $sisalto .= "\n";
     }
 } else {
     include 'inc/pupeExcel.inc';
     $worksheet = new pupeExcel();
     $format_bold = array("bold" => TRUE);
     $excelrivi = 0;
     $excelsarake = 0;
     $worksheet->writeString($excelrivi, $excelsarake, t("Nimi"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Nimitarkenne"), $format_bold);
     $excelsarake++;
     if ($as_yht_tiedot == 'on' or $asiakas_segmentin_yhteystiedot == 'on') {
         $worksheet->writeString($excelrivi, $excelsarake, t("Yhteyshenkilö"), $format_bold);
         $excelsarake++;
         $worksheet->writeString($excelrivi, $excelsarake, t("Titteli"), $format_bold);
         $excelsarake++;
     }
     $worksheet->writeString($excelrivi, $excelsarake, t("Osoite"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Postino"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Postitp"), $format_bold);
     $excelsarake++;
Example #2
0
     echo "<th>" . t("Nimitys") . "</th>";
     echo "<th>" . t("Try") . "</th>";
     echo "<th>" . t("Viimeisin saapuminen") . "</th>";
     echo "<th>" . t("Viimeisin laskutus") . "</th>";
     echo "<th>" . t("Viim. tapahtuma") . "</th>";
     echo "<th>" . t("Epäkurattitaso") . "</th>";
     echo "<th>" . t("Saldo") . "</th>";
     echo "<th>" . t("Kehahin") . "</th>";
     echo "<th>" . t("Varastonarvo") . "</th>";
     echo "<th>" . t("Uusi varastonarvo") . "</th>";
     if (isset($ajo_tee) and $ajo_tee == "EPAKURANTOI") {
         echo "<th></th>";
     }
     echo "</tr>";
 }
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tuote"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Nimitys"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Try"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Viimeisin saapuminen"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Viimeisin laskutus"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Viim. tapahtuma"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Epäkurattitaso"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Saldo"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Kehahin"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Varastonarvo"), $format_bold);
 $worksheet->writeString($excelrivi, $excelsarake++, t("Uusi varastonarvo"), $format_bold);
 $excelrivi++;
 $excelsarake = 0;
 $vararvot_nyt = 0;
 $vararvot_sit = 0;
 while ($epakurantti_row = mysql_fetch_assoc($epakurantti_result)) {
Example #3
0
         for ($excej = 3; $excej < 20; $excej++) {
             $nro = trim($excelrivit[$excei][$excej]);
             if ((double) $nro != 0 or $nro == "!") {
                 $taulunrivit[$excelrivit[$excei][0]][$excelrivit[$excei][1]][$excej - 3] = $nro;
             }
         }
     }
 } else {
     unset($taulunrivit);
 }
 include 'inc/pupeExcel.inc';
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $excelsarake = 0;
 $worksheet->writeString($excelrivi, $excelsarake, t("Tili / Taso"), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, t("Nro"), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, t("Nimi"), $format_bold);
 $excelsarake++;
 echo t("Budjettiluvun voi poistaa huutomerkillä (!)") . "<br><br>";
 //Parametrit mihin tämä taulukko liittyy
 echo "<table>\n";
 echo "<tr>\n";
 echo "<td class='back'></td>\n";
 $j = 0;
 $raja = '0000-00';
 $rajataulu = array();
 $budjetit = array();
 while ($raja < substr($tilikaudetrow['tilikausi_loppu'], 0, 7)) {
Example #4
0
 echo "<tr>";
 echo "<td><a href='{$PHP_SELF}?tee=NAYTATILAUS&tunnus={$tulrow['tunnus']}&ytunnus={$ytunnus}&suunta={$suunta}'>{$tulrow['tunnus']}</a></td>";
 echo "<td>{$tulrow['ytunnus']}</td>";
 echo "<td>{$tulrow['nimi']}</td>";
 echo "<td>" . tv1dateconv($tulrow["toimaika"]) . "</td>";
 echo "<td align='right'>" . sprintf("%.0f", $tulrow["maara"]) . "</td>";
 echo "<td align='right'>" . sprintf("%.2f", $tulrow["tilattu"]) . "</td>";
 echo "<td align='right'>" . sprintf("%.2f", $tulrow["arvo"]) . "</td>";
 echo "<td>{$tulrow['valkoodi']}</td>";
 echo "</tr>";
 $rivsum += $tulrow["maara"];
 $tilsum += $tulrow["tilattu"];
 $eursum += $tulrow["arvo"];
 if (isset($worksheet)) {
     $excelsarake = 0;
     $worksheet->writeString($excelrivi, $excelsarake, $tulrow["tunnus"]);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, $tulrow["ytunnus"]);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, $tulrow["nimi"]);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, tv1dateconv($tulrow["toimaika"]));
     $excelsarake++;
     $worksheet->writeNumber($excelrivi, $excelsarake, $tulrow["maara"]);
     $excelsarake++;
     $worksheet->writeNumber($excelrivi, $excelsarake, $tulrow["tilattu"]);
     $excelsarake++;
     $worksheet->writeNumber($excelrivi, $excelsarake, $tulrow["arvo"]);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, $tulrow["valkoodi"]);
     $excelsarake = 0;
Example #5
0
 }
 include 'inc/pupeExcel.inc';
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $vajaasaldot_table = "<table>";
 $vajaasaldot_table .= "<th>" . t("Osasto") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Tuoteryhmä") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Tuoteno") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Nimitys") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Varastosaldo") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Vapaa saldo") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Tulossa") . "</th>";
 $vajaasaldot_table .= "<th>" . t("Toimaika") . "</th>";
 $excelsarake = 0;
 $worksheet->writeString($excelrivi, $excelsarake++, t("Osasto"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tuoteryhmä"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tuoteno"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Nimitys"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Varastosaldo"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Vapaa saldo"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tulossa"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Toimitusaika"));
 $excelrivi++;
 $query = "SELECT tuote.tuoteno, tuote.nimitys, tuote.osasto, tuote.try\n            FROM tuote\n            {$toimittaja_join}\n            WHERE tuote.yhtio                       = '{$kukarow["yhtio"]}'\n            {$lisa}\n            AND (tuote.status != 'P' OR (  SELECT sum(tuotepaikat.saldo)\n                            FROM tuotepaikat\n                            WHERE tuotepaikat.yhtio = tuote.yhtio\n                            AND tuotepaikat.tuoteno = tuote.tuoteno\n                            AND tuotepaikat.saldo   > 0) > 0)\n            ORDER BY tuote.osasto, tuote.try, tuote.tuoteno";
 $eresult = pupe_query($query);
 $total_rows = mysql_num_rows($eresult);
 $current_row = 0;
 if ($total_rows > 0) {
     echo "<font class='message'>", t("Käsitellään"), " {$total_rows} ", t("tuotetta"), ".</font>";
     require 'inc/ProgressBar.class.php';
Example #6
0
 }
 echo "<td valign='top' align='right'>" . $row["yli_{$saatavat_array[count($saatavat_array) - 1]}"] . "</td>";
 echo "<td valign='top' align='right'>{$row['avoimia']}</td>";
 echo "<td valign='top' align='right'>{$avoimettilaukset}</td>";
 echo "<td valign='top' align='right'>{$kaatotilisumma}</td>";
 echo "<td valign='top' align='right'>" . ($row["avoimia"] + $avoimettilaukset - $kaatotilisumma) . "</td>";
 echo "<td valign='top' align='right'>{$luottotilanne_nyt}</td>";
 echo "<td valign='top' align='right'>{$luottoraja}</td>";
 echo "</tr>";
 if (isset($_avoimia_yhteensa)) {
     $_avoimia_yhteensa = $row["avoimia"] + $avoimettilaukset - $kaatotilisumma;
 }
 if ($eiliittymaa != 'ON') {
     $excelsarake = 0;
     if ($grouppaus != "kustannuspaikka") {
         $worksheet->writeString($excelrivi, $excelsarake, str_replace("<br>", "\n", $row["ytunnus"]));
         $excelsarake++;
         $worksheet->writeString($excelrivi, $excelsarake, str_replace("<br>", "\n", $row["nimi"]));
         $excelsarake++;
     }
     if ($grouppaus == "kustannuspaikka" or $tiliointilisa != "") {
         $worksheet->writeString($excelrivi, $excelsarake, $kustpmuuttuja);
         $excelsarake++;
     }
     $worksheet->writeNumber($excelrivi, $excelsarake, $row["alle_{$saatavat_array['0']}"]);
     $excelsarake++;
     for ($sa = 1; $sa < count($saatavat_array); $sa++) {
         $worksheet->writeNumber($excelrivi, $excelsarake, $row[$saatavat_array[$sa - 1] + 1 . "_" . $saatavat_array[$sa]]);
         $excelsarake++;
     }
     $worksheet->writeNumber($excelrivi, $excelsarake, $row["yli_{$saatavat_array[count($saatavat_array) - 1]}"]);
Example #7
0
 echo "<tr><th>" . t("Syötä alkupäivämäärä (pp-kk-vvvv)") . "</th>\n        <td><input type='text' name='ppa' value='{$ppa}' size='3'></td>\n        <td><input type='text' name='kka' value='{$kka}' size='3'></td>\n        <td><input type='text' name='vva' value='{$vva}' size='5'></td>\n        </tr><tr><th>" . t("Syötä loppupäivämäärä (pp-kk-vvvv)") . "</th>\n        <td><input type='text' name='ppl' value='{$ppl}' size='3'></td>\n        <td><input type='text' name='kkl' value='{$kkl}' size='3'></td>\n        <td><input type='text' name='vvl' value='{$vvl}' size='5'></td></tr>";
 echo "<tr><th>" . t("Summaa myynnit per asiakas") . ":</th><td colspan='3'><input type='radio' name='summaa' value='summaa' {$chk}></td></tr>";
 echo "<tr><th>" . t("Summaa myynnit per ytunnus") . ":</th><td colspan='3'><input type='radio' name='summaa' value='summaa_ytunnus' {$chk1}></td></tr>";
 echo "</table>";
 // Monivalintalaatikot (osasto, try tuotemerkki...)
 // Määritellään mitkä latikot halutaan mukaan
 $monivalintalaatikot = array("OSASTO", "TRY");
 require "../tilauskasittely/monivalintalaatikot.inc";
 echo "<br><input type='submit' name='AJA' value='" . t("Aja raportti") . "'>";
 echo "</form><br><br>";
 if ($matee != '' and isset($AJA)) {
     include 'inc/pupeExcel.inc';
     $worksheet = new pupeExcel();
     $format_bold = array("bold" => TRUE);
     $excelrivi = 0;
     $worksheet->writeString($excelrivi, 0, t("Myynti asiakkaittain"));
     $excelrivi++;
     $select = "lasku.liitostunnus, asiakas.piiri, tuote.aleryhma, max(lasku.ytunnus) ytunnus, max(lasku.nimi) nimi, max(lasku.nimitark) nimitark, ";
     $group = "lasku.liitostunnus, asiakas.piiri, tuote.aleryhma";
     if ($summaa == 'summaa') {
         $select = "lasku.liitostunnus, max(asiakas.ytunnus) ytunnus, max(asiakas.nimi) nimi, max(asiakas.nimitark) nimitark, ";
         $group = "lasku.liitostunnus";
     }
     if ($summaa == 'summaa_ytunnus') {
         $select = "lasku.ytunnus, max(asiakas.nimi) nimi, max(asiakas.nimitark) nimitark, ";
         $group = "lasku.ytunnus";
     }
     $query = "SELECT {$select}\n              sum(tilausrivi.rivihinta) summa,\n              sum(tilausrivi.kate) kate,\n              sum(tilausrivi.kpl) kpl\n              FROM lasku\n              JOIN tilausrivi ON (tilausrivi.yhtio = lasku.yhtio and tilausrivi.uusiotunnus = lasku.tunnus and tilausrivi.tyyppi = 'L')\n              JOIN asiakas ON (asiakas.yhtio = tilausrivi.yhtio and asiakas.tunnus = lasku.liitostunnus)\n              JOIN tuote ON (tuote.yhtio = tilausrivi.yhtio and tuote.tuoteno = tilausrivi.tuoteno)\n              WHERE lasku.yhtio = '{$kukarow['yhtio']}'\n              and lasku.tila    = 'U'\n              and lasku.alatila = 'X'\n              and lasku.tapvm   >= '{$vva}-{$kka}-{$ppa}'\n              and lasku.tapvm   <= '{$vvl}-{$kkl}-{$ppl}'\n              {$lisa}\n              GROUP BY {$group}\n              ORDER BY nimi, nimitark, ytunnus";
     $result = pupe_query($query);
     if (mysql_num_rows($result) < 2000) {
         echo "<table>";
Example #8
0
 }
 echo t("Tuotteita") . " " . mysql_num_rows($res) . " " . t("kpl") . ".<br>";
 if ($valitut["EHDOTETTAVAT"] != '') {
     echo "<font class='message'>" . t("Joista jätetään pois ne tuotteet joita ei ehdoteta ostettavaksi") . ".<br>";
 }
 flush();
 if (mysql_num_rows($res) > 0) {
     require 'inc/ProgressBar.class.php';
     include 'inc/pupeExcel.inc';
     $worksheet = new pupeExcel();
     $format_bold = array("bold" => TRUE);
     $rivi = "";
     $excelrivi = 0;
     $excelsarake = 0;
     $rivi .= t("tuoteno") . "\t";
     $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("tuoteno")), $format_bold);
     $excelsarake++;
     if ($paikoittain != '') {
         $rivi .= t("Varastopaikka") . "\t";
         $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("Varastopaikka")), $format_bold);
         $excelsarake++;
     }
     foreach ($valitut as $val) {
         $rivi .= $sarakkeet[$val];
         if ($sarakkeet[$val] != '') {
             $worksheet->writeString($excelrivi, $excelsarake, ucfirst(trim($sarakkeet[$val])), $format_bold);
             $excelsarake++;
         }
     }
     $rivi .= "\r\n";
     $excelrivi++;
Example #9
0
     $valisummat = array();
 }
 $edluku = $row[mysql_field_name($result, 0)];
 if (is_numeric($row[$fieldname]) and (mysql_field_type($result, $i) == 'real' or mysql_field_type($result, $i) == 'int' or substr($fieldname, 0, 4) == 'kate')) {
     if ($elements <= $rivilimitti) {
         echo "<td valign='top' align='right'>" . sprintf("%.02f", $row[$fieldname]) . "</td>";
     }
     if (isset($worksheet)) {
         $worksheet->writeNumber($excelrivi, $i, sprintf("%.02f", $row[$fieldname]));
     }
 } elseif ($fieldname == 'sarjanumero') {
     if ($elements <= $rivilimitti) {
         echo "<td valign='top'>{$row[$fieldname]}</td>";
     }
     if (isset($worksheet)) {
         $worksheet->writeString($excelrivi, $i, strip_tags(str_replace("<br>", "\n", $row[$fieldname])));
     }
 } else {
     if ($elements <= $rivilimitti) {
         echo "<td valign='top'>{$row[$fieldname]}</td>";
     }
     if (isset($worksheet)) {
         $worksheet->writeString($excelrivi, $i, strip_tags(str_replace("<br>", " / ", $row[$fieldname])));
     }
 }
 if ($i < substr_count($select, ", ")) {
     $valisummat[$i] = "";
     $totsummat[$i] = "";
 } else {
     $valisummat[$i] += $row[$fieldname];
     $totsummat[$i] += $row[$fieldname];
Example #10
0
     $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Myyntivv'></td>";
     $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Myynti12'></td>";
     $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Myynti6'></td>";
     $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Myynti3'></td>";
     if ($listaustyyppi == "kappaleet2") {
         $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Kulutusvv'></td>";
         $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Kulutus12'></td>";
         $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Kulutus6'></td>";
         $varastotilasto_table .= "<td><input type='text' class='search_field' name='search_Kulutus3'></td>";
     }
     $varastotilasto_table .= "</tr>";
     $varastotilasto_table .= "</thead>";
     $varastotilasto_table .= "<tbody>";
 }
 $excelsarake = 0;
 $worksheet->writeString($excelrivi, $excelsarake++, t("Osasto"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tuoteryhmä"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tuoteno"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Nimitys"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("EAN-koodi"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Varastosaldo"));
 if ($nayta_vapaa_saldo == "on") {
     $worksheet->writeString($excelrivi, $excelsarake++, t("Vapaa saldo"));
 }
 $worksheet->writeString($excelrivi, $excelsarake++, t("Varastonarvo"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Myyntihinta"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Varmuusvarasto"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Tilattu määrä"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Toimitus aika"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Varattu saldo"));
 $worksheet->writeString($excelrivi, $excelsarake++, t("Myynti") . " {$vvl}");
Example #11
0
     echo "</td>";
 }
 echo "</tr>";
 echo "</table>";
 if ($oikeurow['paivitys'] == '1') {
     echo "<br>";
     echo "<input type='submit' value='" . t("Tallenna") . "'>";
 }
 echo "</form>";
 echo "<br><br>";
 include 'inc/pupeExcel.inc';
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $excelsarake = 0;
 $worksheet->writeString($excelrivi, $excelsarake++, t("Isätuote"));
 echo "<table class='responsive'>";
 echo "<tr>";
 if ($toim == "PERHE") {
     echo "<th>" . t("Lapset") . "</th>";
     echo "<th>" . t("Nimitys") . "</th>";
     echo "<th>" . t("Määräkerroin") . "</th>";
     echo "<th>" . t("Hintakerroin") . "</th>";
     echo "<th>" . t("Alennuskerroin") . "</th>";
     echo "<th>" . t("Kehahin") . "</th>";
     echo "<th>" . t("Kehahin*Kerroin") . "</th>";
     echo "<th>" . t("Ohita keräys") . "</th>";
     echo "<th>" . t("Ei näytetä") . "</th>";
     $worksheet->writeString($excelrivi, $excelsarake++, t("Lapset"));
     $worksheet->writeString($excelrivi, $excelsarake++, t("Nimitys"));
     $worksheet->writeString($excelrivi, $excelsarake++, t("Määräkerroin"));
 $i++;
 $worksheet->write($excelrivi, $i, t('Tuotemerkki'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Aloitustapahtuma'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Aloitusaika'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Lopetustapahtuma'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Lopetusaika'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Kesto'), $format_bold);
 $i = 0;
 $excelrivi++;
 while ($rivi = mysql_fetch_array($result)) {
     $worksheet->writeString($excelrivi, $i, $rivi['tyomaarays_tunnus']);
     $i++;
     $worksheet->writeString($excelrivi, $i, $rivi['asiakastiedot']);
     $i++;
     $worksheet->writeString($excelrivi, $i, $rivi['valmistaja']);
     $i++;
     $worksheet->writeString($excelrivi, $i, $rivi['alku_nimitys']);
     $i++;
     $worksheet->writeString($excelrivi, $i, $rivi['alkupvm']);
     $i++;
     $worksheet->writeString($excelrivi, $i, $rivi['loppu_nimitys']);
     $i++;
     $worksheet->writeString($excelrivi, $i, $rivi['loppupvm']);
     $i++;
     // Lasketaan business days ensimmäisen ja viimeisen tapahtuman välillä
     $businessdays = count_workdays($rivi['alkupvm'], $rivi['loppupvm']);
Example #13
0
 $i++;
 $worksheet->write($excelrivi, $i, t('Saldo'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Tryno'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('Try'), $format_bold);
 $i++;
 $worksheet->write($excelrivi, $i, t('EAN'), $format_bold);
 $i = 0;
 $excelrivi++;
 while ($productrow = mysql_fetch_array($productqueryresult)) {
     list(, , $apu_myytavissa) = saldo_myytavissa($productrow["tuoteno"]);
     $sresult = t_avainsana("TRY", "", "and avainsana.selite  = '{$productrow['try']}'");
     $srow = mysql_fetch_array($sresult);
     if ($myytavissao == "" or $apu_myytavissa > 0) {
         $worksheet->writeString($excelrivi, $i, $productrow['tuoteno']);
         $i++;
         $worksheet->writeString($excelrivi, $i, $productrow['nimitys']);
         $i++;
         if ($kehahinnat != "") {
             $worksheet->writeNumber($excelrivi, $i, $productrow['kehahin']);
             $i++;
         }
         $worksheet->writeNumber($excelrivi, $i, $productrow['myyntihinta']);
         $i++;
         $worksheet->writeNumber($excelrivi, $i, $apu_myytavissa);
         $i++;
         $worksheet->writeString($excelrivi, $i, $productrow["try"]);
         $i++;
         $worksheet->writeString($excelrivi, $i, $srow["selitetark"]);
         $i++;
Example #14
0
 if (isset($teexls) and $teexls == "OK") {
     include 'inc/pupeExcel.inc';
     $worksheet = new pupeExcel();
     $format_bold = array("bold" => TRUE);
     $excelrivi = 0;
     $excelhist = 0;
     $pi = 1;
     for ($i = $alkukausi; $i < count($kaudet); $i++) {
         foreach ($sarakkeet as $sarake) {
             if (strpos($sarake, "::") !== FALSE) {
                 list($muuarray, $arvo) = explode("::", $sarake);
                 $sarakenimi = ${$muuarray}[$arvo] . "\n";
             } else {
                 $sarakenimi = "";
             }
             $worksheet->writeString(0, $pi, $sarakenimi . $kaudet[$i], $format_bold);
             $pi++;
         }
     }
 }
 // PDF-koodia
 if (isset($teepdf) and $teepdf == "OK") {
     require_once 'pdflib/phppdflib.class.php';
     $pdf = new pdffile();
     $pdf->set_default('margin', 0);
     $pdf->set_default('margin-left', 5);
     $rectparam["width"] = 0.3;
     $p["height"] = 10;
     $p["font"] = "Times-Roman";
     $b["height"] = 8;
     $b["font"] = "Times-Bold";
Example #15
0
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $sarakemaara = mysql_num_fields($result);
 for ($i = 0; $i < $sarakemaara; $i++) {
     $worksheet->write($excelrivi, $i, ucfirst(t(mysql_field_name($result, $i))), $format_bold);
 }
 $excelrivi++;
 $bar = new ProgressBar();
 $bar->initialize(mysql_num_rows($result));
 while ($row = mysql_fetch_row($result)) {
     $bar->increase();
     for ($i = 0; $i < $sarakemaara; $i++) {
         if (mysql_field_type($result, $i) == 'real') {
             $worksheet->writeNumber($excelrivi, $i, sprintf("%.02f", $row[$i]));
         } else {
             $worksheet->writeString($excelrivi, $i, $row[$i]);
         }
     }
     $excelrivi++;
 }
 $excelnimi = $worksheet->close();
 echo "<br><br><table>";
 echo "<tr><th>" . t("Tallenna Excel") . ":</th><td class='back'>";
 echo "<form method='post' class='multisubmit'>";
 echo "<input type='hidden' name='toim' value='{$toim}'>";
 echo "<input type='hidden' name='tee' value='lataa_tiedosto'>";
 echo "<input type='hidden' name='kaunisnimi' value='SQLhaku.xlsx'>";
 echo "<input type='hidden' name='tmpfilenimi' value='{$excelnimi}'>";
 echo "<input type='submit' value='" . t("Tallenna") . "'></form></td></tr>";
 echo "</table><br>";
 if ($toim == "SUPER") {
Example #16
0
 echo "<br>";
 echo t("Luodaan Excel.");
 echo "<br>";
 flush();
 $bar = new ProgressBar();
 $bar->initialize($rivi_count);
 //print the empty bar
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => true);
 $excelrivi = 0;
 $excelsarake = 0;
 // Otetaan headerit
 $headerit = str_getcsv($headerivi, "\t");
 // Kirjoitetaan headerit
 foreach ($headerit as $header) {
     $worksheet->writeString($excelrivi, $excelsarake++, $header, $format_bold);
 }
 $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) {
Example #17
0
     $tuote_epa_rajaus = "and epakurantti25pvm != '0000-00-00' and epakurantti50pvm != '0000-00-00' and epakurantti75pvm != '0000-00-00' and epakurantti100pvm != '0000-00-00'";
 }
 // etsitään saldolliset tuotteet
 $query = "SELECT tuote.tuoteno,\n               tuote.osasto,\n               tuote.try,\n               tuote.myyntihinta,\n               tuote.nimitys,\n               tuote.tahtituote,\n               tuote.status,\n               tuote.hinnastoon,\n               round(if(epakurantti75pvm = '0000-00-00', if(epakurantti50pvm = '0000-00-00', if(epakurantti25pvm = '0000-00-00', kehahin, kehahin * 0.75), kehahin * 0.5), kehahin * 0.25), 6) kehahin,\n               tuote.vihapvm,\n               epakurantti25pvm,\n               epakurantti50pvm,\n               epakurantti75pvm,\n               tuote.tuotemerkki,\n               tuote.myyjanro,\n               tuote.sarjanumeroseuranta,\n               sum(saldo) saldo\n               FROM tuote\n               JOIN tuotepaikat ON (tuotepaikat.yhtio = tuote.yhtio and tuotepaikat.tuoteno = tuote.tuoteno)\n               WHERE tuote.yhtio             = '{$kukarow['yhtio']}'\n               AND tuote.ei_saldoa           = ''\n               AND tuote.tuotetyyppi         NOT IN ('A', 'B')\n               AND tuote.sarjanumeroseuranta NOT IN ('S','G')\n               {$epakuranttipvm}\n               {$tuote_epa_rajaus}\n               {$lisa}\n               GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16\n               HAVING saldo != 0\n               ORDER BY tuote.tuoteno";
 $result = pupe_query($query);
 echo "<br><font class='message'>" . t("Löytyi") . " " . mysql_num_rows($result) . " " . t("sopivaa tuotetta. Lasketaan ehdotus.") . "</font><br>";
 flush();
 $yhteensopivuus_table_check = table_exists("yhteensopivuus_tuote");
 $elements = mysql_num_rows($result);
 // total number of elements to process
 include 'inc/pupeExcel.inc';
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $excelsarake = 0;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("osasto")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("try")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("tuotemerkki")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("määrä")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("myytävissä")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("kierto")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("tahtituote")), $format_bold);
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, ucfirst(t("status")), $format_bold);
 $excelsarake++;
Example #18
0
     mysql_data_seek($result, 0);
 }
 $tallennusmuoto_check = $tallennusmuoto == "excel";
 if ($tallennusmuoto_check) {
     include 'inc/pupeExcel.inc';
     $worksheet = new pupeExcel();
     $format_bold = array("bold" => TRUE);
     $excelrivi = 0;
     $excelsarake = 0;
 } else {
     $tiedostonimi = "varastonarvo_tuotteittain-{$kukarow['yhtio']}-" . date("YmdHis") . ".csv";
     $fh = fopen("/tmp/" . $tiedostonimi, "w");
 }
 if ($summaustaso != "T" and $summaustaso != "TRY") {
     if ($tallennusmuoto_check) {
         $worksheet->writeString($excelrivi, $excelsarake, t("Varasto"), $format_bold);
         $excelsarake++;
     } else {
         fwrite($fh, pupesoft_csvstring(t("Varasto")) . "\t");
     }
 }
 if ($summaustaso == "P") {
     if ($tallennusmuoto_check) {
         $worksheet->writeString($excelrivi, $excelsarake, t("Hyllyalue"), $format_bold);
         $excelsarake++;
         $worksheet->writeString($excelrivi, $excelsarake, t("Hyllynro"), $format_bold);
         $excelsarake++;
         $worksheet->writeString($excelrivi, $excelsarake, t("Hyllyvali"), $format_bold);
         $excelsarake++;
         $worksheet->writeString($excelrivi, $excelsarake, t("Hyllytaso"), $format_bold);
         $excelsarake++;
Example #19
0
 }
 echo "<br><br><font class='message'>" . t("Asiakashinnastoa luodaan...") . "</font><br>";
 flush();
 require_once 'inc/ProgressBar.class.php';
 $bar = new ProgressBar();
 $elements = mysql_num_rows($rresult);
 // total number of elements to process
 $bar->initialize($elements);
 // print the empty bar
 include 'inc/pupeExcel.inc';
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $excelsarake = 0;
 if (isset($worksheet)) {
     $worksheet->writeString($excelrivi, 0, t("Ytunnus", $hinkieli) . ": {$ytunnus}", $format_bold);
     $excelrivi++;
     $worksheet->writeString($excelrivi, 0, t("Asiakas", $hinkieli) . ": {$asiakasrow['nimi']} {$asiakasrow['nimitark']}", $format_bold);
     $excelrivi++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Tuotenumero", $hinkieli), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("EAN-koodi", $hinkieli), $format_bold);
     $excelsarake++;
     if (!$tuoteryhmaosasto) {
         $worksheet->writeString($excelrivi, $excelsarake, t("Osasto", $hinkieli), $format_bold);
         $excelsarake++;
         $worksheet->writeString($excelrivi, $excelsarake, t("Tuoteryhmä", $hinkieli), $format_bold);
         $excelsarake++;
     }
     $worksheet->writeString($excelrivi, $excelsarake, t("Nimitys", $hinkieli), $format_bold);
     $excelsarake++;
Example #20
0
             $otsikko = "ero %";
             break;
         case 'sisäinen_kommentti':
             $otsikko = "sisäinen kommentti";
             break;
         case 'koneen_hinta':
             $otsikko = "koneen hinta";
             break;
         case 'kate':
             $otsikko = "Kate %";
             break;
         default:
             $otsikko = $key;
     }
     $otsikko = ucfirst(t($otsikko));
     $worksheet->writeString($excelrivi, $excelsarake, $otsikko, $format_bold);
     $excelsarake++;
     $otsikot .= "<th>{$otsikko}</th>";
 }
 echo $otsikot;
 echo "</tr>";
 $excelsarake = 0;
 $excelrivi++;
 $user = '';
 $total_user = 0;
 $total = 0;
 $ed_tilaus = 0;
 $tilaus = 0;
 $odd = '';
 foreach ($data as $set) {
     echo "<tr>";
Example #21
0
     $row[$ken_nimi] = $varaston_saldo;
 }
 if ($ken_nimi != 'asiakaslista' and $ken_nimi != "tuotelista") {
     if ($ken_lask >= $data_start_index and is_numeric($row[$ken_nimi])) {
         if ($rivimaara <= $rivilimitti) {
             echo "<td valign='top' align='right'>" . sprintf("%.02f", $row[$ken_nimi]) . "</td>";
         }
         if (isset($worksheet)) {
             $worksheet->writeNumber($excelrivi, $excelsarake++, sprintf("%.02f", $row[$ken_nimi]));
         }
     } elseif ($ken_nimi == 'sarjanumero') {
         if ($rivimaara <= $rivilimitti) {
             echo "<td valign='top'>{$row[$ken_nimi]}</td>";
         }
         if (isset($worksheet)) {
             $worksheet->writeString($excelrivi, $excelsarake++, strip_tags(str_replace("<br>", "\n", $row[$ken_nimi])));
         }
     } else {
         if ($rivimaara <= $rivilimitti) {
             if ($ken_nimi == 'asiakasosasto') {
                 if ($ruksit['asiakasosasto'] != '' and $ruksit[20] != '') {
                     $serialisoitavat_muuttujat["mul_asiakasosasto"][$ken_nimi] = '';
                     $serialisoitavat_muuttujat['ruksit'][20] = '';
                 } else {
                     $serialisoitavat_muuttujat["mul_asiakasosasto"][$ken_nimi] = $asiakasosasto_temp;
                     $serialisoitavat_muuttujat['ruksit'][20] = 'asiakasnro';
                 }
                 echo "<td valign='top'>{$row[$ken_nimi]}</td>";
                 echo "<td>";
                 if ($serialisoitavat_muuttujat["ruksit"][$ken_nimi] != '' and $asiakasosasto_temp != "" and $ruksit["asiakasryhma"] != "") {
                     $serialisoitavat_muuttujat["mul_asiakasryhma"]["asiakasryhmä"] = $row["asiakasryhmä"];
Example #22
0
 if ($rivit == "puutteet") {
     $rivilisa = " HAVING puutekpl <> 0 ";
 }
 $query_ale_lisa = generoi_alekentta('M');
 if ($try != '') {
     $query = "SELECT tilausrivi.osasto, tilausrivi.try, tilausrivi.tuoteno, tilausrivi.nimitys, lasku.ytunnus, asiakas.asiakasnro,\n              round(sum(if (tilausrivi.var='P', tilausrivi.tilkpl, 0)),2) puutekpl,\n              round(sum(if (tilausrivi.var='P', tilausrivi.tilkpl*tilausrivi.hinta*{$query_ale_lisa}/(1+(tilausrivi.alv/100)), 0)),2) puuteeur,\n              round(sum(if ((tilausrivi.var='' or tilausrivi.var='H'), tilausrivi.tilkpl*tilausrivi.hinta*{$query_ale_lisa}/(1+(tilausrivi.alv/100)), 0)),2) myyeur\n              FROM tilausrivi\n              LEFT JOIN lasku ON lasku.yhtio=tilausrivi.yhtio and lasku.tunnus=tilausrivi.otunnus\n              LEFT JOIN asiakas ON lasku.yhtio=asiakas.yhtio and lasku.liitostunnus=asiakas.tunnus\n              LEFT JOIN tuote ON tuote.yhtio=tilausrivi.yhtio and tilausrivi.tuoteno=tuote.tuoteno\n              WHERE tilausrivi.yhtio  = '{$kukarow['yhtio']}'\n              and tilausrivi.laadittu >= '{$vva}-{$kka}-{$ppa} 00:00:00'\n              and tilausrivi.laadittu <= '{$vvl}-{$kkl}-{$ppl} 23:59:59'\n              and tilausrivi.var      in ('P','H','')\n              and tilausrivi.osasto   = '{$osasto}'\n              and tilausrivi.try      = '{$try}'\n              and tilausrivi.tyyppi  ='L'\n              {$lisaasiakas}\n              and tuote.status        NOT IN ('P','X')\n              GROUP BY tilausrivi.osasto, tilausrivi.try, tilausrivi.tuoteno, tilausrivi.nimitys, lasku.ytunnus\n              HAVING puutekpl <> 0\n              ORDER BY tilausrivi.osasto, tilausrivi.try, tilausrivi.tuoteno, tilausrivi.nimitys, lasku.ytunnus";
 } else {
     $query = "SELECT tilausrivi.osasto, tilausrivi.try {$sellisa},\n              round(sum(if (tilausrivi.var='P', tilausrivi.tilkpl, 0)),2) puutekpl,\n              round(sum(if (tilausrivi.var='P', tilausrivi.tilkpl*tilausrivi.hinta*{$query_ale_lisa}/(1+(tilausrivi.alv/100)), 0)),2) puuteeur,\n              round(sum(if (tilausrivi.var='' or tilausrivi.var='H', tilausrivi.tilkpl*tilausrivi.hinta*{$query_ale_lisa}/(1+(tilausrivi.alv/100)), 0)),2) myyeur\n              FROM tilausrivi\n              LEFT JOIN lasku ON lasku.yhtio=tilausrivi.yhtio and lasku.tunnus=tilausrivi.otunnus\n              LEFT JOIN tuote ON tuote.yhtio=tilausrivi.yhtio and tilausrivi.tuoteno=tuote.tuoteno\n              WHERE tilausrivi.yhtio = '{$kukarow['yhtio']}'\n              and tilausrivi.tyyppi  = 'L'\n              and tilausrivi.laadittu >='{$vva}-{$kka}-{$ppa} 00:00:00'\n              and tilausrivi.laadittu <='{$vvl}-{$kkl}-{$ppl} 23:59:59'\n              and tilausrivi.var     in ('P','H','')\n              {$lisaasiakas}\n              and tuote.status       NOT IN ('P','X')\n              GROUP BY tilausrivi.osasto, tilausrivi.try {$sellisa}\n              {$rivilisa}\n              ORDER BY tilausrivi.osasto, tilausrivi.try {$sellisa}";
 }
 $result = pupe_query($query);
 include 'inc/pupeExcel.inc';
 $worksheet = new pupeExcel();
 $format_bold = array("bold" => TRUE);
 $excelrivi = 0;
 $pvm = date("Ymd");
 $worksheet->writeString($excelrivi, 0, t("Puutelistaus"));
 $worksheet->writeString($excelrivi, 1, $pvm);
 $excelrivi++;
 $excelsarake = 0;
 $worksheet->writeString($excelrivi, $excelsarake, t("Osasto"));
 $excelsarake++;
 $worksheet->writeString($excelrivi, $excelsarake, t("Tuoteryhmä"));
 $excelsarake++;
 if ($raportointitaso == 'tuote') {
     $worksheet->writeString($excelrivi, $excelsarake, t("Tuotenumero"));
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Nimitys"));
     $excelsarake++;
 }
 if ($try != '') {
     $worksheet->writeString($excelrivi, $excelsarake, t("Ytunnus"));
Example #23
0
 //käännetään kauniiksi
 if ($debug == '1') {
     echo "filenimi = {$filenimi}<br>";
 } else {
     system("a2ps -o " . $filenimi . ".ps -r --medium=A4 --chars-per-line={$rivinleveys} --no-header --columns=1 --margin=0 --borders=0 {$filenimi}");
     if ($komento["Inventointi"] == 'email') {
         system("ps2pdf -sPAPERSIZE=a4 " . $filenimi . ".ps " . $filenimi . ".pdf");
         $liite = $filenimi . ".pdf";
         $kutsu = t("Inventointilista") . "_{$listanro}";
         require "inc/sahkoposti.inc";
     } elseif ($komento["Inventointi"] == 'excel') {
         include 'inc/pupeExcel.inc';
         $worksheet = new pupeExcel();
         $excelrivi = 0;
         $excelsarake = 0;
         $worksheet->writeString($excelrivi++, $excelsarake++, $excel_info, array("bold" => TRUE));
         $excelrivi++;
         $excelsarake = 0;
         foreach ($excelheaderit as $value) {
             $worksheet->writeString($excelrivi, $excelsarake++, $value, array("bold" => TRUE));
         }
         $excelrivi++;
         $excelsarake = 0;
         foreach ($excelrivit as $key => $value) {
             if ($yhtiorow['laaja_inventointilista'] != "") {
                 $worksheet->writeString($excelrivi, 0, $excelrivit[$key]['rivinro']);
                 $excelsarake = 1;
             }
             foreach ($excelrivit[$key] as $_k => $value) {
                 if ($yhtiorow['laaja_inventointilista'] != "" and $_k == 'rivinro') {
                     continue;
 echo "<table class='display dataTable' id='{$pupe_DataTables}'>";
 echo "<thead>";
 echo "<tr>";
 echo "<th>", t("CSV"), "</th>";
 echo "<th>#</th>";
 echo "<th>", t("ytunnus"), "</th>";
 echo "<th>", t("nimi"), "</th>";
 echo "<th>", t("laskunro"), "</th>";
 echo "<th>", t("pvm"), "</th>";
 echo "<th>", t("laskun summa"), "</th>";
 echo "<th>", t("alv"), "</th>";
 echo "<th>", t("verot"), "</th>";
 echo "<th>", t("erikoiskoodi"), "</th>";
 echo "</tr>";
 if (isset($worksheet)) {
     $worksheet->writeString($excelrivi, $excelsarake, "#", $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Ytunnus"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Nimi"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Laskunro"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Pvm"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Laskun summa"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("ALV"), $format_bold);
     $excelsarake++;
     $worksheet->writeString($excelrivi, $excelsarake, t("Verot"), $format_bold);
     $excelsarake++;
Example #25
0
 $worksheet->write($excelrivi, 4, t("Poikkeama"), $format_bold);
 $worksheet->write($excelrivi, 5, t("Poikkeama") . " %", $format_bold);
 $worksheet->write($excelrivi, 6, t("Yksikkö"), $format_bold);
 $worksheet->write($excelrivi, 7, t("Inv.pvm"), $format_bold);
 $worksheet->write($excelrivi, 8, t("Varastonarvo ennen inventointia"), $format_bold);
 $worksheet->write($excelrivi, 9, t("Arvonmuutos"), $format_bold);
 $worksheet->write($excelrivi, 10, t("Selite"), $format_bold);
 $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>";
Example #26
0
    if ($paikoittain == 'JOO') {
        $sel = "CHECKED";
    }
    echo "<td><input type='checkbox' name='paikoittain' value='JOO' {$sel}></td>";
}
echo "<td class='back'><input type='submit' name='ajoon' value='" . t("Aja raportti") . "'></td>";
echo "</tr>";
echo "</form>";
echo "</table><br>";
if ($aja == "AJA" and isset($ajoon)) {
    include 'inc/pupeExcel.inc';
    $worksheet = new pupeExcel();
    $format_bold = array("bold" => TRUE);
    $excelrivi = 0;
    $excelsarake = 0;
    $worksheet->writeString($excelrivi, $excelsarake++, t("ABC"));
    $worksheet->writeString($excelrivi, $excelsarake++, t("Osaston luokka"));
    $worksheet->writeString($excelrivi, $excelsarake++, t("Ryhmän luokka"));
    $worksheet->writeString($excelrivi, $excelsarake++, $astusana);
    if (!$asiakasanalyysi) {
        $worksheet->writeString($excelrivi, $excelsarake++, t("Toim_tuoteno"));
    }
    $worksheet->writeString($excelrivi, $excelsarake++, t("Nimitys"));
    $worksheet->writeString($excelrivi, $excelsarake++, t("Osasto"));
    $worksheet->writeString($excelrivi, $excelsarake++, t("Ryhmä"));
    if (!$asiakasanalyysi) {
        $worksheet->writeString($excelrivi, $excelsarake++, t("Merkki"));
    }
    if (!$asiakasanalyysi) {
        $worksheet->writeString($excelrivi, $excelsarake++, t("Malli"));
    }
Example #27
0
     } else {
         $otsik = array("alennusryhmä", "tuoteno", "asiakasryhmä", "alennus", "{$alennuslaji}", "alkupvm", "loppupvm", "tyyppi");
         $otsik_spread = array("alennusryhmä", "alennusryhmä_nimi", "tuoteno", "tuoteno_nimi", "asiakasryhmä", "alennus", "{$alennuslaji}", "alkupvm", "loppupvm");
     }
 }
 // Otsikot
 if ($yhdistetty == "") {
     $ulos .= "<tr>";
     foreach ($otsik as $o) {
         $ulos .= "<th>" . t(ucfirst($o)) . "</th>";
     }
     $ulos .= "</tr>";
 }
 if ($yhdistetty == "") {
     foreach ($otsik_spread as $key => $value) {
         $worksheet->writeString($excelrivi, $key, t(ucfirst($value)), $format_bold);
     }
     $excelrivi++;
 }
 unset($edryhma);
 unset($edryhma2);
 $osastot = array();
 $tryt = array();
 //  Haetaan osastot ja avainsanat muistiin
 // tehdään avainsana query
 $tryres = t_avainsana("OSASTO");
 while ($tryrow = mysql_fetch_assoc($tryres)) {
     $osastot[$tryrow["selite"]] = $tryrow["selitetark"];
 }
 // tehdään avainsana query
 $tryres = t_avainsana("TRY");
Example #28
0
         echo "<td class='{$class}' align='right' valign='top'>" . $row[$fieldname] . "</td>";
     } elseif ($yhtiorow['laiterekisteri_kaytossa'] != '' and $whiletoim == "YLLAPITO" and $fieldname == 'sarjanumero') {
         // Haetaan sopimusriviin liitetyt sarjanumerot laiterekisteristä/laitteen_sopimuksista
         $query = "SELECT\n                    group_concat(distinct laite.sarjanro SEPARATOR '<br>') sarjanumerot\n                    FROM laitteen_sopimukset\n                    JOIN laite ON laite.tunnus = laitteen_sopimukset.laitteen_tunnus\n                    WHERE laitteen_sopimukset.sopimusrivin_tunnus IN ({$row['tilausrivitunnukset']})";
         $res = pupe_query($query);
         $sarjanumerotrivi = mysql_fetch_assoc($res);
         echo "<td class='{$class}' valign='top'>{$sarjanumerotrivi['sarjanumerot']}</td>";
     } else {
         echo "<td class='{$class}' valign='top'>" . $row[$fieldname] . "</td>";
     }
     if (isset($worksheet)) {
         if ($fieldname == "asiakas") {
             $nimiosat = explode("<br>", $row[$fieldname]);
             $ytunnari = trim(array_shift($nimiosat));
             $lopnimit = trim(implode("\n", $nimiosat));
             $worksheet->writeString($excelrivi, $ii, $ytunnari);
             $ii++;
             $worksheet->writeString($excelrivi, $ii, $lopnimit);
             $ii++;
         } elseif (mysql_field_type($result, $i) == 'real') {
             $worksheet->writeNumber($excelrivi, $ii, sprintf("%.02f", $row[$fieldname]));
             $ii++;
         } else {
             $worksheet->writeString($excelrivi, $ii, $row[$fieldname]);
             $ii++;
         }
     }
 }
 if ($row["tila"] == "N" and $row["alatila"] == "U") {
     if ($jtok == 0) {
         echo "<td class='{$class}' valign='top'><font class='green'>" . t("Voidaan toimittaa") . "</font></td>";