From 66b0d287b8520fbd15ded3b3d7416be0301fe1ca Mon Sep 17 00:00:00 2001 From: Lars Kusch Date: Wed, 5 Apr 2023 14:57:26 +0200 Subject: [PATCH] Added compatibilty to XRechnung 2.2 --- app/Jobs/Invoice/CreateXInvoice.php | 8 ++++++-- lang/en/texts.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Jobs/Invoice/CreateXInvoice.php b/app/Jobs/Invoice/CreateXInvoice.php index a64a66a0eea9..c15268153788 100644 --- a/app/Jobs/Invoice/CreateXInvoice.php +++ b/app/Jobs/Invoice/CreateXInvoice.php @@ -74,7 +74,7 @@ class CreateXInvoice implements ShouldQueue ->setDocumentSupplyChainEvent(date_create($invoice->date)) ->setDocumentSeller($company->getSetting('name')) ->setDocumentSellerAddress($company->getSetting("address1"), "", "", $company->getSetting("postal_code"), $company->getSetting("city"), $company->country()->iso_3166_2) - ->setDocumentSellerContact($invoice->user->first_name." ".$invoice->user->last_name) + ->setDocumentSellerContact($invoice->user->first_name." ".$invoice->user->last_name, "", $invoice->user->phone, "", $invoice->user->email) ->setDocumentBuyer($client->name, $client->number) ->setDocumentBuyerAddress($client->address1, "", "", $client->postal_code, $client->city, $client->country->iso_3166_2) ->setDocumentBuyerReference($client->leitweg_id) @@ -86,6 +86,10 @@ class CreateXInvoice implements ShouldQueue if (!empty($invoice->po_number)) { $xrechnung->setDocumentBuyerOrderReferencedDocument($invoice->po_number); } + if (empty($client->leitweg_id)){ + $xrechnung->setDocumentBuyerReference(ctrans("texts.xinvoice_no_buyers_reference")); + } + $xrechnung->addDocumentPaymentMean(10, ""); if (str_contains($company->getSetting('vat_number'), "/")) { $xrechnung->addDocumentSellerTaxRegistration("FC", $company->getSetting('vat_number')); @@ -107,7 +111,7 @@ class CreateXInvoice implements ShouldQueue } else { $xrechnung->setDocumentPositionQuantity($item->quantity, "H87"); } - $linenetamount = $item->line_total + $item->surcharge_1 + $item->surcharge_2 + $item->surcharge_3; + $linenetamount = $item->line_total; if ($item->discount > 0){ if ($invoice->is_amount_discount){ $linenetamount -= $item->discount; diff --git a/lang/en/texts.php b/lang/en/texts.php index 69d2394c31c6..dc2aef973ffb 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -5021,7 +5021,7 @@ $LANG = array( 'payment_type_Klarna' => 'Klarna', 'payment_type_Interac E Transfer' => 'Interac E Transfer', 'xinvoice_payable' => 'Payable within :payeddue days net until :paydate', - + 'xinvoice_no_buyers_reference' => "No buyer's reference given", );