Esempio n. 1
0
// täällä pilkotaan Finvoiceaineiston laskut omiksi tiedostoikseen
// Käsitellään ensin kaikki Finvoicet
if ($handle = opendir($laskut)) {
    while (($file = readdir($handle)) !== FALSE) {
        if (!is_file($laskut . "/" . $file)) {
            continue;
        }
        $nimi = $laskut . "/" . $file;
        // Muutetaan oikeaan merkistöön
        $encoding = exec("file -b --mime-encoding '{$nimi}'");
        if (!PUPE_UNICODE and $encoding != "" and strtoupper($encoding) != 'ISO-8859-15') {
            exec("recode -f {$encoding}..ISO-8859-15 '{$nimi}'");
        } elseif (PUPE_UNICODE and $encoding != "" and strtoupper($encoding) != 'UTF-8') {
            exec("recode -f {$encoding}..UTF8 '{$nimi}'");
        }
        $luotiinlaskuja = erittele_laskut($nimi);
        // Jos tiedostosta luotiin laskuja siirretään se tieltä pois
        if ($luotiinlaskuja > 0) {
            // Logitetaan ajo
            cron_log($origlaskut . "/" . $file);
            rename($laskut . "/" . $file, $origlaskut . "/" . $file);
        }
    }
}
if ($handle = opendir($laskut)) {
    while (($file = readdir($handle)) !== FALSE) {
        if (!is_file($laskut . "/" . $file)) {
            continue;
        }
        // $yhtiorow ja $xmlstr
        unset($yhtiorow);
Esempio n. 2
0
 require "inc/verkkolasku-in.inc";
 echo "<table><tr>";
 echo "<th>" . t("Vastaanottaja") . "<br>" . t("Yhtiö") . "</th><th>" . t("Toiminto") . "</th><th>" . t("Ovttunnus") . "<br>" . t("Y-tunnus") . "</th><th>" . t("Toimittaja") . "</th><th>" . t("Laskunumero") . "<br>" . t("Maksutili") . "<br>" . t("Summa") . "</th><th>" . t("Pvm") . "</th></tr><tr>";
 while (($file = readdir($handle)) !== FALSE) {
     if (is_file($verkkolaskuvirheet_vaarat . "/" . $file) and substr($file, 0, 1) != ".") {
         unset($yhtiorow);
         unset($xmlstr);
         // Napataan alkuperäinen kukarow
         $vv_kukarow = $kukarow;
         $returni = verkkolasku_in($verkkolaskuvirheet_vaarat . "/" . $file, FALSE);
         if (is_array($returni)) {
             $lasku_yhtio = $returni[0];
             $lasku_toimittaja = $returni[1];
         } elseif (stripos($returni, "ei ole validi XML") !== FALSE) {
             $laskut = $verkkolaskuvirheet_vaarat;
             $luotiinlaskuja = erittele_laskut($verkkolaskuvirheet_vaarat . "/" . $file);
             // Jos tiedostosta luotiin laskuja siirretään se tieltä pois
             if ($luotiinlaskuja > 0) {
                 rename($verkkolaskuvirheet_vaarat . "/" . $file, $verkkolaskut_orig . "/" . $file);
             }
             $lasku_yhtio["yhtio"] = "EI KIITOS TÄLLÄ KERTAA";
         }
         // Palautetaan alkuperäinen kukarow
         $kukarow = $vv_kukarow;
         if ($lasku_yhtio["yhtio"] == $kukarow["yhtio"] or $lasku_yhtio["yhtio"] == "") {
             $valitutlaskut++;
             // Otetaan tarvittavat muuttujat tännekin
             $xml = simplexml_load_string($xmlstr);
             // Katsotaan mitä aineistoa käpistellään
             if (strpos($file, "finvoice") !== false or strpos($file, "maventa") !== false or strpos($file, "apix") !== false) {
                 require "inc/verkkolasku-in-finvoice.inc";