Minor fixes for zug docs

This commit is contained in:
David Bomba 2024-07-02 18:36:53 +10:00
parent a67de99b49
commit bb159be386

View File

@ -41,6 +41,7 @@ class ZugferdEDocument extends AbstractService {
*/ */
public function run(): Expense public function run(): Expense
{ {
/** @var \App\Models\User $user */
$user = auth()->user(); $user = auth()->user();
$this->document = ZugferdDocumentReader::readAndGuessFromContent($this->tempdocument); $this->document = ZugferdDocumentReader::readAndGuessFromContent($this->tempdocument);
$this->document->getDocumentInformation($documentno, $documenttypecode, $documentdate, $invoiceCurrency, $taxCurrency, $documentname, $documentlanguage, $effectiveSpecifiedPeriod); $this->document->getDocumentInformation($documentno, $documenttypecode, $documentdate, $invoiceCurrency, $taxCurrency, $documentname, $documentlanguage, $effectiveSpecifiedPeriod);
@ -102,13 +103,13 @@ class ZugferdEDocument extends AbstractService {
if ($taxid != null) { if ($taxid != null) {
$vendor->vat_number = $taxid; $vendor->vat_number = $taxid;
} }
$vendor->currency_id = Currency::whereCode($invoiceCurrency)->first()->id; $vendor->currency_id = Currency::query()->where('code', $invoiceCurrency)->first()->id;
$vendor->phone = $contact_phone; $vendor->phone = $contact_phone;
$vendor->address1 = $address_1; $vendor->address1 = $address_1;
$vendor->address2 = $address_2; $vendor->address2 = $address_2;
$vendor->city = $city; $vendor->city = $city;
$vendor->postal_code = $postcode; $vendor->postal_code = $postcode;
$vendor->country_id = Country::where('iso_3166_2', $country)->first()->id; $vendor->country_id = Country::query()->where('iso_3166_2', $country)->first()->id;
$vendor->save(); $vendor->save();
$expense->vendor_id = $vendor->id; $expense->vendor_id = $vendor->id;