xmlrechnung exportbuchhaltung

This commit is contained in:
OpenXE 2025-01-15 13:58:00 +01:00
parent 65f6d9e8c1
commit 23953e70b8

View File

@ -167,7 +167,6 @@ class Exportbuchhaltung
$sachkonto = $this->app->Secure->GetPOST('sachkonto');
$format = $this->app->Secure->GetPOST('format');
$pdfexport = $this->app->Secure->GetPOST("pdfexport");
$account_id = null;
if (!empty($sachkonto)) {
$sachkonto_kennung = explode(' ',$sachkonto)[0];
@ -219,7 +218,6 @@ class Exportbuchhaltung
//---------- DOWNLOAD HERE
if ($submit == 'Download') {
$dataok = true;
if (
!$rgchecked &&
!$gschecked &&
@ -250,6 +248,7 @@ class Exportbuchhaltung
$filename_csv = "EXTF_".date('Ymd') . "_Buchungsstapel_DATEV_export.csv";
try {
$csv = $this->DATEV_Buchuchungsstapel($rgchecked, $gschecked, $vbchecked, $lgchecked, $buchhaltung_berater, $buchhaltung_mandant, $buchhaltung_wj_beginn, $buchhaltung_sachkontenlaenge, $von, $bis, $projekt, $filename_csv, $diffignore, $sachkonto_kennung, $format);
if ($pdfexport) {
$dateinamezip = 'Export_Buchhaltung_'.date('Y-m-d').'.zip';
@ -267,13 +266,20 @@ class Exportbuchhaltung
WHERE
b.".$typ['field_date']." BETWEEN '".date_format($von,"Y-m-d")."' AND '".date_format($bis,"Y-m-d")."' AND (b.projekt=$projekt OR $projekt=0)".$typ['condition_where'];
$belege = $this->app->DB->SelectArr($sql);
foreach ($belege as $beleg) {
foreach ($belege as $beleg) {
if (!$typ['do']) {
continue;
}
switch ($typ['pdf']) {
$action = $typ['pdf'];
if ($typ['typ'] == 'rechnung') {
if ($this->app->DB->Select("SELECT xmlrechnung FROM rechnung WHERE id = ".$beleg['id'])) {
$action = 'load';
}
}
switch ($action) {
case 'print':
switch ($typ['typ']) {
case 'rechnung':
@ -307,9 +313,10 @@ class Exportbuchhaltung
$suffix = "";
$count = 0;
foreach ($file_attachments as $file_attachment) {
if ($this->app->erp->GetDateiEndung($file_attachment) == 'pdf') {
$ending = $this->app->erp->GetDateiEndung($file_attachment);
if (in_array($ending,['pdf','xml'])) {
$file_contents = $this->app->erp->GetDatei($file_attachment);
$file_name = filter_var($beleg['belegnr'],FILTER_SANITIZE_EMAIL).$suffix.".pdf";
$file_name = filter_var($beleg['belegnr'],FILTER_SANITIZE_EMAIL).$suffix.".".$ending;
$zip->addFromString($typ['typ']."/".$file_name, $file_contents);
$count++;
$suffix = "_".$count;
@ -320,7 +327,6 @@ class Exportbuchhaltung
}
}
$zip->close();
// download
header('Content-Type: application/zip');
header("Content-Disposition: attachment; filename=$dateinamezip");
@ -717,9 +723,6 @@ class Exportbuchhaltung
// Query position data
$arr = $this->app->DB->Query($sql);
while ($row = $this->app->DB->Fetch_Assoc($arr)) {
//print_r($row);
$posid = $row['pos_id'];
$tmpsteuersatz = 0;
$tmpsteuertext = '';