1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Ninja/Presenters/ClientPresenter.php

66 lines
1.3 KiB
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Ninja\Presenters;
2015-11-12 21:36:28 +01:00
2017-08-13 15:03:00 +02:00
use Utils;
2017-01-30 17:05:31 +01:00
class ClientPresenter extends EntityPresenter
{
2015-11-12 21:36:28 +01:00
public function country()
{
return $this->entity->country ? $this->entity->country->name : '';
}
2016-02-04 19:36:39 +01:00
2016-08-07 21:42:32 +02:00
public function balance()
{
$client = $this->entity;
$account = $client->account;
return $account->formatMoney($client->balance, $client);
}
2017-08-13 15:03:00 +02:00
public function websiteLink()
{
$client = $this->entity;
if (! $client->website) {
return '';
}
$link = Utils::addHttp($client->website);
return link_to($link, $client->website, ['target' => '_blank']);
}
2016-08-07 21:42:32 +02:00
public function paid_to_date()
{
$client = $this->entity;
$account = $client->account;
return $account->formatMoney($client->paid_to_date, $client);
}
2017-02-01 12:09:26 +01:00
public function paymentTerms()
{
$client = $this->entity;
if (! $client->payment_terms) {
return '';
}
return sprintf('%s: %s %s', trans('texts.payment_terms'), trans('texts.payment_terms_net'), $client->defaultDaysDue());
}
/**
* @return string
*/
public function taskRate()
{
if ($this->entity->task_rate) {
return Utils::roundSignificant($this->entity->task_rate);
} else {
return '';
}
}
2016-05-23 11:26:08 +02:00
}