xrechnung export xml

This commit is contained in:
OpenXE 2024-10-31 21:43:05 +01:00
parent 052552adfb
commit 8690fc7264
3 changed files with 105 additions and 0 deletions

View File

@ -119053,6 +119053,45 @@
"Non_unique": ""
}
]
},
{
"name": "smarty_templates",
"collation": "utf8mb3_general_ci",
"type": "BASE TABLE",
"columns": [
{
"Field": "id",
"Type": "int(11)",
"Collation": null,
"Null": "NO",
"Key": "PRI",
"Default": null,
"Extra": "auto_increment",
"Privileges": "select,insert,update,references",
"Comment": ""
},
{
"Field": "template",
"Type": "text",
"Collation": "utf8mb3_general_ci",
"Null": "NO",
"Key": "",
"Default": null,
"Extra": "",
"Privileges": "select,insert,update,references",
"Comment": ""
}
],
"keys": [
{
"Key_name": "PRIMARY",
"Index_type": "BTREE",
"columns": [
"id"
],
"Non_unique": ""
}
]
}
],
"views": [

View File

@ -55,6 +55,8 @@ class Rechnung extends GenRechnung
$this->app->ActionHandler("freigabe","RechnungFreigabe");
$this->app->ActionHandler("abschicken","RechnungAbschicken");
$this->app->ActionHandler("pdf","RechnungPDF");
$this->app->ActionHandler("xml","RechnungSmarty");
$this->app->ActionHandler("json","RechnungJSON");
$this->app->ActionHandler("alternativpdf","RechnungAlternativPDF");
$this->app->ActionHandler("inlinepdf","RechnungInlinePDF");
$this->app->ActionHandler("lastschrift","RechnungLastschrift");
@ -547,6 +549,7 @@ class Rechnung extends GenRechnung
$menu .= "
<a href=\"index.php?module=rechnung&action=pdf&id=%value%\"><img border=\"0\" src=\"./themes/new/images/pdf.svg\" title=\"PDF\"></a>
<a href=\"index.php?module=rechnung&action=xml&id=%value%\"><img border=\"0\" src=\"./themes/new/images/xml.svg\" title=\"XML\"></a>
<!-- <a href=\"index.php?module=rechnung&action=edit&id=%value%\" title=\"Bearbeiten\"><img border=\"0\" src=\"./themes/new/images/edit.svg\"></a>
<a onclick=\"if(!confirm('Wirklich stornieren?')) return false; else window.location.href='index.php?module=rechnung&action=delete&id=%value%';\" title=\"Stornieren\">
<img src=\"./themes/new/images/delete.svg\" border=\"0\"></a>
@ -1243,6 +1246,68 @@ class Rechnung extends GenRechnung
$this->RechnungList();
}
// Print PHP array for SmartyXML
function RechnungJSON() {
$this->RechnungSmarty(true);
}
function RechnungSmarty($json = false) {
$id = $this->app->Secure->GetGET('id');
$result = Array();
$result['rechnungssteller']['name'] = $this->app->erp->Firmendaten('name');
$result['rechnungssteller']['strasse'] = $this->app->erp->Firmendaten('strasse');
$result['rechnungssteller']['ort'] = $this->app->erp->Firmendaten('ort');
$result['rechnungssteller']['plz'] = $this->app->erp->Firmendaten('plz');
$result['rechnungssteller']['land'] = $this->app->erp->Firmendaten('land');
$result['rechnungssteller']['steuernummer'] = $this->app->erp->Firmendaten('steuernummer');
$rechnung = $this->app->DB->SelectRow("
SELECT * FROM rechnung WHERE id = $id LIMIT 1
");
$result['kopf'] = $rechnung;
$adresse = $this->app->DB->SelectArr("
SELECT * FROM adresse WHERE id = (SELECT adresse FROM rechnung WHERE id = $id LIMIT 1)
");
$result['adresse'] = $adresse[0];
$positionen = $this->app->DB->SelectArr("
SELECT * FROM rechnung_position WHERE rechnung = $id ORDER BY sort ASC
");
$steuern = Array();
foreach ($positionen as $key => $position) {
$this->app->erp->GetSteuerPosition('rechnung', $position['id'], $steuersatz, $steuertext, $erloes);
$positionen[$key]['steuersatz'] = $steuersatz;
$positionen[$key]['steuertext'] = $steuertext;
$positionen[$key]['erloese'] = $erloes;
$steuern[$steuersatz]['umsatz_netto'] += $position['umsatz_netto_gesamt'];
$steuern[$steuersatz]['umsatz_brutto'] += $position['umsatz_brutto_gesamt'];
$steuern[$steuersatz]['prozent'] = $steuersatz;
}
$result['positionen'] = $positionen;
$result['steuern'] = $steuern;
$filename = str_replace('-','',$result['kopf']['datum']).'_RE'.$result['kopf']['belegnr'];
if ($json) {
header('Content-type:text/plain');
header('Content-Disposition: attachment;filename='.$filename.'.json');
echo(json_encode($result,JSON_PRETTY_PRINT));
} else {
$template = $this->app->DB->Select("SELECT template from smarty_templates LIMIT 1");
$smarty = new Smarty;
$smarty->assign('rechnung', $result);
$html = $smarty->fetch('string:'.$template);
header('Content-type:application/xml');
header('Content-Disposition: attachment;filename='.$filename.'.xml');
echo($html);
}
$this->app->ExitXentral();
}
function RechnungSuche()
{
$this->app->Tpl->Set('UEBERSCHRIFT','Rechnungen');

View File

@ -0,0 +1 @@
<svg version="1.2" width="5.56mm" height="5.56mm" viewBox="0 0 556 556" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xml:space="preserve"><defs class="ClipPathGroup"><clipPath id="a" clipPathUnits="userSpaceOnUse"><path d="M0 0h556v556H0z"/></clipPath></defs><g class="SlideGroup"><g class="Slide" clip-path="url(#a)"><g class="Page"><g class="com.sun.star.drawing.PolyPolygonShape"><path class="BoundingBox" fill="none" d="M57 57h443v443H57z"/><path fill="#929292" d="M246 299h22l-32-69 29-62h-21l-22 46-21-46h-22l31 62-34 69h22l24-52 24 52Zm112 0h18V168h-27l-18 77-4 21-4-18-1-7-17-73h-28v131h18V191l7 35 18 73h14l17-73 8-35-1 23v85Zm33 0h73v-21h-52V168h-21v131Zm63-241h5l4 1 4 1 4 1 4 2 4 2 3 3 3 3 3 3 3 3 2 4 2 4 1 4 1 4 1 4v274l-1 4-1 4-1 4-2 4-2 4-3 3-3 3-3 3-3 3-4 2-4 2-4 1-4 1-4 1H185l-4-1-4-1-4-1-4-2-4-2-3-3-3-3-3-3-3-3-2-4-2-4-1-4-1-4-1-4V97l1-4 1-4 1-4 2-4 2-4 3-3 3-3 3-3 3-3 4-2 4-2 4-1 4-1 4-1h269ZM71 147l11-1h2l2 1h2l2 1 2 2 2 1 1 1 2 2 1 1 1 2 1 2 1 2v2l1 2v272l1 2 1 2v2l2 1 1 2 1 2 2 1 2 1 1 2h2l2 1 2 1h272l2 1h2l2 1 2 1 2 1 1 1 2 2 1 1 1 2 2 2 1 2v2l1 2v9l-1 2v2l-1 2-2 1-1 2-1 2-2 1-1 1-2 1-2 1-2 1-2 1H97l-4-1-4-1-4-1-4-2-4-2-3-3-3-3-3-3-3-3-2-4-2-4-1-4-1-4-1-4V163l1-2 1-2 1-2 1-2 1-1 1-2 2-1 2-1 1-2 2-1Z"/></g></g></g></g></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB