mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixed some bugs
This commit is contained in:
parent
3239431faa
commit
fd72b1dce5
@ -87,8 +87,7 @@ class CreateXInvoice implements ShouldQueue
|
||||
|
||||
if (str_contains($company->getSetting('vat_number'), "/")) {
|
||||
$xrechnung->addDocumentSellerTaxRegistration("FC", $company->getSetting('vat_number'));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$xrechnung->addDocumentSellerTaxRegistration("VA", $company->getSetting('vat_number'));
|
||||
}
|
||||
|
||||
@ -103,37 +102,31 @@ class CreateXInvoice implements ShouldQueue
|
||||
->setDocumentPositionNetPrice($item->line_total);
|
||||
if (isset($item->task_id)) {
|
||||
$xrechnung->setDocumentPositionQuantity($item->quantity, "HUR");
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$xrechnung->setDocumentPositionQuantity($item->quantity, "H87");
|
||||
}
|
||||
|
||||
// According to european law, each line item can only have one tax rate
|
||||
if (!empty($item->tax_name1)) {
|
||||
$xrechnung->addDocumentPositionTax(getTaxType($item->tax_name1), 'VAT', $item->tax_rate1);
|
||||
}
|
||||
elseif (!empty($item->tax_name2)){
|
||||
} elseif (!empty($item->tax_name2)) {
|
||||
$xrechnung->addDocumentPositionTax(getTaxType($item->tax_name2), 'VAT', $item->tax_rate2);
|
||||
}
|
||||
elseif (!empty($item->tax_name3)){
|
||||
} elseif (!empty($item->tax_name3)) {
|
||||
$xrechnung->addDocumentPositionTax(getTaxType($item->tax_name3), 'VAT', $item->tax_rate3);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
nlog("Can't add correct tax position");
|
||||
}
|
||||
|
||||
if (!empty($invoice->tax_name1)) {
|
||||
$xrechnung->addDocumentPositionTax(getTaxType($invoice->tax_name1), 'VAT', $invoice->tax_rate1);
|
||||
}
|
||||
elseif (!empty($invoice->tax_name2)){
|
||||
} elseif (!empty($invoice->tax_name2)) {
|
||||
$xrechnung->addDocumentPositionTax(getTaxType($invoice->tax_name2), 'VAT', $invoice->tax_rate2);
|
||||
}
|
||||
elseif (!empty($invoice->tax_name3)){
|
||||
} elseif (!empty($invoice->tax_name3)) {
|
||||
$xrechnung->addDocumentPositionTax(getTaxType($invoice->tax_name3), 'VAT', $item->tax_rate3);
|
||||
} else {
|
||||
nlog("Can't add correct tax position");}
|
||||
nlog("Can't add correct tax position");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($invoice->isPartial()) {
|
||||
@ -164,8 +157,7 @@ class CreateXInvoice implements ShouldQueue
|
||||
$pdfBuilder = new ZugferdDocumentPdfBuilder($xrechnung, $this->custompdfpath);
|
||||
$pdfBuilder->generateDocument();
|
||||
$pdfBuilder->saveDocument($this->custompdfpath);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$filepath_pdf = $client->invoice_filepath($invoice->invitations->first()) . $invoice->getFileName();
|
||||
$file = Storage::disk($disk)->exists($filepath_pdf);
|
||||
if ($file) {
|
||||
@ -177,9 +169,8 @@ class CreateXInvoice implements ShouldQueue
|
||||
}
|
||||
return $client->invoice_filepath($invoice->invitations->first()) . $invoice->getFileName("xml");
|
||||
}
|
||||
}
|
||||
|
||||
private function getTaxType(string $name)
|
||||
private function getTaxType(string $name): string
|
||||
{
|
||||
$taxtype = "";
|
||||
switch ($name) {
|
||||
@ -213,3 +204,4 @@ private function getTaxType(string $name)
|
||||
}
|
||||
return $taxtype;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user