diff --git a/app/Jobs/Invoice/CreateXRechnung.php b/app/Jobs/Invoice/CreateXRechnung.php
index faddda18a3ab..cfe5fec9014d 100644
--- a/app/Jobs/Invoice/CreateXRechnung.php
+++ b/app/Jobs/Invoice/CreateXRechnung.php
@@ -49,8 +49,11 @@ class CreateXRechnung implements ShouldQueue
->setDocumentSeller($company->name)
->setDocumentSellerAddress($company->address1, "", "", $company->postal_code, $company->city, $company->country->country->iso_3166_2)
->setDocumentBuyer($client->name, $client->number)
- ->setDocumentBuyerAddress($client->address1, "", "", $client->postal_code, $client->city, $client->country->country->iso_3166_2);
- //->addDocumentPaymentTerm("Zahlbar innerhalb 30 Tagen netto bis 04.04.2018, 3% Skonto innerhalb 10 Tagen bis 15.03.2018")
+ ->setDocumentBuyerAddress($client->address1, "", "", $client->postal_code, $client->city, $client->country->country->iso_3166_2)
+ ->setDocumentBuyerReference($client->leitweg_id)
+ ->setDocumentBuyerContact($client->primary_contact->first_name." ".$client->primary_contact->last_name, "", $client->primary_contact->phone, "", $client->primary_contact->email)
+ ->setDocumentBuyerOrderReferencedDocument($invoice->po_number)
+ ->addDocumentPaymentTerm(ctrans("texts.xinvoice_payable", ['payeddue' => date_create($invoice->date)->diff(date_create($invoice->due_date))->format("%d"), 'paydate' => $invoice->due_date]));
if (str_contains($company->vat_number, "/")){
$xrechnung->addDocumentSellerTaxRegistration("FC", $company->vat_number);
diff --git a/app/Models/Client.php b/app/Models/Client.php
index 2259a449adfb..25b553f25f4c 100644
--- a/app/Models/Client.php
+++ b/app/Models/Client.php
@@ -41,6 +41,7 @@ use Laracasts\Presenter\PresentableTrait;
* @property string|null $client_hash
* @property string|null $logo
* @property string|null $phone
+ * @property string|null leitweg_id
* @property string $balance
* @property string $paid_to_date
* @property string $credit_balance
@@ -220,6 +221,7 @@ class Client extends BaseModel implements HasLocalePreference
'public_notes',
'phone',
'number',
+ 'leitweg_id',
];
protected $with = [
@@ -268,6 +270,7 @@ class Client extends BaseModel implements HasLocalePreference
'id_number',
'public_notes',
'phone',
+ 'leitweg_id',
];
// public function scopeExclude($query)
diff --git a/database/migrations/2023_03_13_156872_add_letiweg_id_to_clients_table.php b/database/migrations/2023_03_13_156872_add_letiweg_id_to_clients_table.php
new file mode 100644
index 000000000000..c176897dd993
--- /dev/null
+++ b/database/migrations/2023_03_13_156872_add_letiweg_id_to_clients_table.php
@@ -0,0 +1,31 @@
+string('leitweg_idf')->default(null);
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ *
+ * @return void
+ */
+ public function down()
+ {
+
+ }
+};
diff --git a/lang/en/texts.php b/lang/en/texts.php
index 8d6ff548d554..69d2394c31c6 100644
--- a/lang/en/texts.php
+++ b/lang/en/texts.php
@@ -5020,6 +5020,7 @@ $LANG = array(
'white_label_body' => 'Thank you for purchasing a white label license.
Your license key is:
:license_key',
'payment_type_Klarna' => 'Klarna',
'payment_type_Interac E Transfer' => 'Interac E Transfer',
+ 'xinvoice_payable' => 'Payable within :payeddue days net until :paydate',
);