mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 17:04:36 -04:00
Fixes for XInvoice and differniate between Profiles
This commit is contained in:
parent
a765153642
commit
dd49768aef
@ -175,6 +175,9 @@ class SendRemindersCron extends Command
|
|||||||
$invoice->calc()->getInvoice()->save();
|
$invoice->calc()->getInvoice()->save();
|
||||||
$invoice->fresh();
|
$invoice->fresh();
|
||||||
$invoice->service()->deletePdf()->save();
|
$invoice->service()->deletePdf()->save();
|
||||||
|
if ($invoice->company->use_xinvoice){
|
||||||
|
$invoice->service()->deleteXInvoice()->save();
|
||||||
|
}
|
||||||
|
|
||||||
/* Refresh the client here to ensure the balance is fresh */
|
/* Refresh the client here to ensure the balance is fresh */
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
|
@ -36,7 +36,34 @@ class CreateXInvoice implements ShouldQueue
|
|||||||
$invoice = $this->invoice;
|
$invoice = $this->invoice;
|
||||||
$company = $invoice->company;
|
$company = $invoice->company;
|
||||||
$client = $invoice->client;
|
$client = $invoice->client;
|
||||||
$xrechnung = ZugferdDocumentBuilder::CreateNew(ZugferdProfiles::PROFILE_EN16931);
|
$profile = "";
|
||||||
|
switch ($company->xinvoice_type){
|
||||||
|
case "EN16931":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_EN16931;
|
||||||
|
break;
|
||||||
|
case "XInvoice_2_2":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_XRECHNUNG_2_2;
|
||||||
|
break;
|
||||||
|
case "XInvoice_2_1":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_XRECHNUNG_2_1;
|
||||||
|
break;
|
||||||
|
case "XInvoice_2_0":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_XRECHNUNG_2;
|
||||||
|
break;
|
||||||
|
case "XInvoice_1_0":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_XRECHNUNG;
|
||||||
|
break;
|
||||||
|
case "XInvoice-Extended":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_EXTENDED;
|
||||||
|
break;
|
||||||
|
case "XInvoice-BasicWL":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_BASICWL;
|
||||||
|
break;
|
||||||
|
case "XInvoice-Basic":
|
||||||
|
$profile = ZugferdProfiles::PROFILE_BASIC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$xrechnung = ZugferdDocumentBuilder::CreateNew($profile);
|
||||||
|
|
||||||
$xrechnung
|
$xrechnung
|
||||||
->setDocumentInformation($invoice->number, "380", date_create($invoice->date), $invoice->client->getCurrencyCode())
|
->setDocumentInformation($invoice->number, "380", date_create($invoice->date), $invoice->client->getCurrencyCode())
|
||||||
|
@ -78,7 +78,7 @@ class ZipInvoices implements ShouldQueue
|
|||||||
|
|
||||||
$this->invoices->each(function ($invoice) {
|
$this->invoices->each(function ($invoice) {
|
||||||
(new CreateEntityPdf($invoice->invitations()->first()))->handle();
|
(new CreateEntityPdf($invoice->invitations()->first()))->handle();
|
||||||
if ($this->company->getSetting("create_xinvoice")){
|
if ($this->company->use_xinvoice){
|
||||||
(new CreateXInvoice($invoice))->handle();
|
(new CreateXInvoice($invoice))->handle();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -97,6 +97,8 @@ use Laracasts\Presenter\PresentableTrait;
|
|||||||
* @property int $stock_notification
|
* @property int $stock_notification
|
||||||
* @property string|null $matomo_url
|
* @property string|null $matomo_url
|
||||||
* @property int|null $matomo_id
|
* @property int|null $matomo_id
|
||||||
|
* @property bool $use_xinvoice
|
||||||
|
* @property string $xinvoice_type
|
||||||
* @property int $enabled_expense_tax_rates
|
* @property int $enabled_expense_tax_rates
|
||||||
* @property int $invoice_task_project
|
* @property int $invoice_task_project
|
||||||
* @property int $report_include_deleted
|
* @property int $report_include_deleted
|
||||||
@ -354,6 +356,8 @@ class Company extends BaseModel
|
|||||||
'google_analytics_key',
|
'google_analytics_key',
|
||||||
'matomo_url',
|
'matomo_url',
|
||||||
'matomo_id',
|
'matomo_id',
|
||||||
|
'use_xinvoice',
|
||||||
|
'xinvoice_type',
|
||||||
'client_can_register',
|
'client_can_register',
|
||||||
'enable_shop_api',
|
'enable_shop_api',
|
||||||
'invoice_task_timelog',
|
'invoice_task_timelog',
|
||||||
|
@ -17,6 +17,10 @@ return new class extends Migration
|
|||||||
Schema::table('clients', function (Blueprint $table) {
|
Schema::table('clients', function (Blueprint $table) {
|
||||||
$table->string('leitweg_idf')->default(null);
|
$table->string('leitweg_idf')->default(null);
|
||||||
});
|
});
|
||||||
|
Schema::table('companies', function (Blueprint $table) {
|
||||||
|
$table->boolean('use_xinvoice')->default(false);
|
||||||
|
$table->string('xinvoice_type')->default("EN16931");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
Loading…
x
Reference in New Issue
Block a user