invoiceninja/app/Ninja/Presenters/ClientPresenter.php

39 lines
859 B
PHP
Raw Normal View History

2017-01-30 21:40:43 +02:00
<?php
namespace App\Ninja\Presenters;
2015-11-12 22:36:28 +02:00
2017-01-30 18:05:31 +02:00
class ClientPresenter extends EntityPresenter
{
2015-11-12 22:36:28 +02:00
public function country()
{
return $this->entity->country ? $this->entity->country->name : '';
}
2016-02-04 20:36:39 +02:00
2016-08-07 22:42:32 +03:00
public function balance()
{
$client = $this->entity;
$account = $client->account;
return $account->formatMoney($client->balance, $client);
}
public function paid_to_date()
{
$client = $this->entity;
$account = $client->account;
return $account->formatMoney($client->paid_to_date, $client);
}
2017-02-01 13:09:26 +02: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());
}
2016-05-23 12:26:08 +03:00
}