1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Add expense number

This commit is contained in:
David Bomba 2024-10-17 08:46:53 +11:00
parent defec2c601
commit 34524f3ed3
2 changed files with 7 additions and 1 deletions

View File

@ -1571,6 +1571,7 @@ class Import implements ShouldQueue
} catch(\Exception $e) {
nlog($e->getMessage());
//do nothing, gracefully :)
}
}

View File

@ -24,6 +24,7 @@ use App\Utils\TempFile;
use App\Utils\Traits\SavesDocuments;
use Exception;
use App\Models\Company;
use App\Repositories\ExpenseRepository;
use horstoeko\zugferd\ZugferdDocumentReader;
use horstoeko\zugferdvisualizer\ZugferdVisualizer;
use horstoeko\zugferdvisualizer\renderer\ZugferdVisualizerLaravelRenderer;
@ -90,6 +91,7 @@ class ZugferdEDocument extends AbstractService
$this->document->getDocumentTax($categoryCode, $typeCode, $basisAmount, $calculatedAmount, $rateApplicablePercent, $exemptionReason, $exemptionReasonCode, $lineTotalBasisAmount, $allowanceChargeBasisAmount, $taxPointDate, $dueDateTypeCode);
$expense->{"tax_amount$counter"} = $calculatedAmount;
$expense->{"tax_rate$counter"} = $rateApplicablePercent;
$expense->{"tax_name$counter"} = $typeCode;
$counter++;
} while ($this->document->nextDocumentTax());
}
@ -147,7 +149,10 @@ class ZugferdEDocument extends AbstractService
nlog("Zugferd: Document already exists");
$expense->private_notes = $expense->private_notes . ctrans("texts.edocument_import_already_exists", ["date" => time()]);
}
$expense->save();
$expense_repo = new ExpenseRepository();
$expense = $expense_repo->save([],$expense);
return $expense;
}
}