Fixes for e-invoices

This commit is contained in:
David Bomba 2023-09-26 09:30:08 +10:00
parent 203279fb27
commit aa5f00cd33
3 changed files with 9 additions and 8 deletions

View File

@ -93,7 +93,7 @@ class StoreClientRequest extends Request
$rules['number'] = ['bail', 'nullable', Rule::unique('clients')->where('company_id', $user->company()->id)];
$rules['id_number'] = ['bail', 'nullable', Rule::unique('clients')->where('company_id', $user->company()->id)];
$rules['classification'] = 'bail|sometimes|nullable|in:individual,company,partnership,trust,charity,government,other';
$rules['classification'] = 'bail|sometimes|nullable|in:individual,business,partnership,trust,charity,government,other';
return $rules;
}

View File

@ -60,7 +60,7 @@ class UpdateClientRequest extends Request
$rules['size_id'] = 'integer|nullable';
$rules['country_id'] = 'integer|nullable';
$rules['shipping_country_id'] = 'integer|nullable';
$rules['classification'] = 'bail|sometimes|nullable|in:individual,company,partnership,trust,charity,government,other';
$rules['classification'] = 'bail|sometimes|nullable|in:individual,business,partnership,trust,charity,government,other';
if ($this->id_number) {
$rules['id_number'] = Rule::unique('clients')->where('company_id', $user->company()->id)->ignore($this->client->id);

View File

@ -182,9 +182,9 @@ class FacturaEInvoice extends AbstractService
Storage::makeDirectory($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()));
}
$this->fac->export(Storage::disk($disk)->path($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig")));
return $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig");
// $this->fac->export(Storage::disk($disk)->path($this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig")));
return $this->fac->export();
// return $this->invoice->client->e_invoice_filepath($this->invoice->invitations->first()) . $this->invoice->getFileName("xsig");
}
@ -469,9 +469,10 @@ class FacturaEInvoice extends AbstractService
$company = $this->invoice->company;
$seller = new FacturaeParty([
"isLegalEntity" => $company->custom_value1, // Se asume true si se omite
// "isLegalEntity" => $company->custom_value1, // Se asume true si se omite
"isLegalEntity" => $this->invoice->client->classification === 'individual' ? false : true,
"taxNumber" => $company->settings->vat_number,
"name" => substr($company->present()->name(), 0, 40),
"name" => $company->getSetting('classification') === 'individual' ? substr($company->owner()->present()->name(), 0, 40) : substr($company->present()->name(), 0, 40),
"address" => substr($company->settings->address1, 0, 80),
"postCode" => substr($this->invoice->client->postal_code, 0, 5),
"town" => substr($company->settings->city, 0, 50),
@ -504,7 +505,7 @@ class FacturaEInvoice extends AbstractService
{
$buyer = new FacturaeParty([
"isLegalEntity" => $this->invoice->client->has_valid_vat_number,
"isLegalEntity" => $this->invoice->client->classification === 'individual' ? false : true,
"taxNumber" => $this->invoice->client->vat_number,
"name" => substr($this->invoice->client->present()->name(),0, 40),
"firstSurname" => substr($this->invoice->client->present()->first_name(),0, 40),