Skip to content

Commit

Permalink
Add expense number
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo124 committed Oct 16, 2024
1 parent defec2c commit 34524f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/Jobs/Util/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,7 @@ private function processDocuments(array $data): void


} catch(\Exception $e) {
nlog($e->getMessage());
//do nothing, gracefully :)
}
}
Expand Down
7 changes: 6 additions & 1 deletion app/Services/EDocument/Imports/ZugferdEDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand Down Expand Up @@ -90,6 +91,7 @@ public function run(): Expense
$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());
}
Expand Down Expand Up @@ -147,7 +149,10 @@ public function run(): Expense
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;
}
}

0 comments on commit 34524f3

Please sign in to comment.