Example #1
0
    finvoice_rivi($tootfinvoice, $tilrow, $laskurow, $vatamount);
    finvoice_lasku_loppu($tootfinvoice, $laskurow, $pankkitiedot, $masrow);
    fclose($tootfinvoice);
    $files_out['files'] = array();
    $files_out['filenames'] = array();
    //Finvoice
    $files_out['files'][0] = base64_encode(file_get_contents($finvoice_file_path));
    $files_out['filenames'][0] = "Maksukehotus_" . date("Ymd") . "_" . $laskutiedot['laskunro'] . ".xml";
    //PDFä
    $files_out['files'][1] = base64_encode(file_get_contents($pdffilenimi));
    $files_out['filenames'][1] = "Maksukehotus_" . date("Ymd") . "_" . $laskutiedot['laskunro'] . ".pdf";
    // Tehdään validaatio Application Requestille
    $axml = new DomDocument('1.0');
    $axml->encoding = 'UTF-8';
    $axml->loadXML(file_get_contents($finvoice_file_path));
    $return_value = $client->invoice_put_finvoice($api_keys, $files_out);
    if (stristr($return_value->status, 'OK')) {
        echo t("Maksukehotus lähetettiin Maventaan") . "\n<br>";
    } else {
        echo '<font class="error">' . t("Maksukehotuksen lähetys maventaan epäonnistui") . " ({$return_value->status})</font>\n<br>";
        throw new Exception("Maventa Error.");
    }
}
// jos halutaan eKirje sekä configuraatio on olemassa niin
// lähetetään eKirje
if (isset($_POST['ekirje_laheta']) === true and (isset($ekirje_config) and is_array($ekirje_config))) {
    // ---------------------------------------------------------------------
    // tähän ekirjeen lähetys
    // pdfekirje luokka
    require_once 'inc/ekirje.inc';
    list($usec, $sec) = explode(' ', microtime());