Added Xinvoice to more pdf-downlaods

This commit is contained in:
Lars Kusch 2023-04-05 15:31:40 +02:00
parent 66b0d287b8
commit 6756de3c2b
2 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,7 @@
namespace App\Jobs\Entity;
use App\Exceptions\FilePermissionsFailure;
use App\Jobs\Invoice\CreateXInvoice;
use App\Libraries\MultiDB;
use App\Models\Credit;
use App\Models\CreditInvitation;
@ -211,7 +212,9 @@ class CreateEntityPdf implements ShouldQueue
throw new FilePermissionsFailure($e->getMessage());
}
}
if ($this->entity_string == "invoice" && $this->company->use_xinvoice){
(new CreateXInvoice($this->entity, true))->handle();
}
$this->invitation = null;
$this->entity = null;
$this->company = null;
@ -219,7 +222,8 @@ class CreateEntityPdf implements ShouldQueue
$this->contact = null;
$maker = null;
$state = null;
return $file_path;
}

View File

@ -73,12 +73,13 @@ class CreateXInvoice implements ShouldQueue
->setDocumentInformation($invoice->number, "380", date_create($invoice->date), $invoice->client->getCurrencyCode())
->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)
->setDocumentSellerAddress($company->getSetting("address1"), $company->getSetting("address2"), "", $company->getSetting("postal_code"), $company->getSetting("city"), $company->country()->iso_3166_2, $company->getSetting("state"))
->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)
->setDocumentBuyerContact($client->primary_contact()->first()->first_name . " " . $client->primary_contact()->first()->last_name, "", $client->primary_contact()->first()->phone, "", $client->primary_contact()->first()->email)
->setDocumentShipToAddress($client->shipping_address1, $client->shipping_address2, "", $client->shipping_postal_code, $client->shipping_city, $client->shipping_country->iso_3166_2, $client->shipping_state)
->addDocumentPaymentTerm(ctrans("texts.xinvoice_payable", ['payeddue' => date_create($invoice->date)->diff(date_create($invoice->due_date))->format("%d"), 'paydate' => $invoice->due_date]));
if (!empty($invoice->public_notes)) {
$xrechnung->addDocumentNote($invoice->public_notes);