Add vendor relation to invoice

This commit is contained in:
David Bomba 2022-02-07 20:52:11 +11:00
parent 4fe06b8a29
commit d7e9f64472
3 changed files with 9 additions and 1 deletions

View File

@ -834,7 +834,6 @@ class Client extends BaseModel implements HasLocalePreference
return 0; return 0;
$timezone = $this->company->timezone(); $timezone = $this->company->timezone();
$offset -= $timezone->utc_offset; $offset -= $timezone->utc_offset;
$offset += ($entity_send_time * 3600); $offset += ($entity_send_time * 3600);

View File

@ -152,6 +152,11 @@ class Invoice extends BaseModel
return $this->belongsTo(Project::class); return $this->belongsTo(Project::class);
} }
public function vendor()
{
return $this->belongsTo(Vendor::class);
}
public function design() public function design()
{ {
return $this->belongsTo(Design::class); return $this->belongsTo(Design::class);

View File

@ -153,6 +153,10 @@ class HtmlEngine
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')]; $data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project_name')];
$data['$invoice.project'] = &$data['$project.name']; $data['$invoice.project'] = &$data['$project.name'];
} }
if($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
}
} }
if ($this->entity_string == 'quote') { if ($this->entity_string == 'quote') {