2019-08-29 06:07:04 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models\Presenters;
|
|
|
|
|
2019-09-05 07:04:52 +02:00
|
|
|
use App\Utils\Number;
|
|
|
|
use App\Utils\Traits\MakesDates;
|
|
|
|
|
2019-08-29 06:07:04 +02:00
|
|
|
/**
|
|
|
|
* Class InvoicePresenter
|
|
|
|
*
|
|
|
|
* For convenience and to allow users to easiliy
|
|
|
|
* customise their invoices, we provide all possible
|
|
|
|
* invoice variables to be available from this presenter.
|
|
|
|
*
|
|
|
|
* Shortcuts to other presenters are here to facilitate
|
|
|
|
* a clean UI / UX
|
|
|
|
*
|
|
|
|
* @package App\Models\Presenters
|
|
|
|
*/
|
|
|
|
class InvoicePresenter extends EntityPresenter
|
|
|
|
{
|
2019-09-05 07:04:52 +02:00
|
|
|
use MakesDates;
|
2019-08-29 06:07:04 +02:00
|
|
|
|
2019-12-24 22:55:29 +01:00
|
|
|
|
|
|
|
public function amount()
|
|
|
|
{
|
|
|
|
return Number::formatMoney($this->balance, $this->client);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function invoice_number()
|
|
|
|
{
|
|
|
|
|
|
|
|
if($this->number != '')
|
|
|
|
return $this->number;
|
|
|
|
else
|
|
|
|
return '';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2019-08-29 06:07:04 +02:00
|
|
|
public function clientName()
|
|
|
|
{
|
|
|
|
return $this->client->present()->name();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function address()
|
|
|
|
{
|
|
|
|
return $this->client->present()->address();
|
|
|
|
}
|
|
|
|
|
2019-08-30 08:16:39 +02:00
|
|
|
public function shippingAddress()
|
2019-08-29 06:07:04 +02:00
|
|
|
{
|
|
|
|
return $this->client->present()->shipping_address();
|
|
|
|
}
|
2019-08-29 06:12:09 +02:00
|
|
|
|
2019-08-30 08:16:39 +02:00
|
|
|
public function companyLogo()
|
2019-08-29 06:12:09 +02:00
|
|
|
{
|
|
|
|
return $this->company->logo;
|
|
|
|
}
|
|
|
|
|
2019-08-30 08:16:39 +02:00
|
|
|
public function clientLogo()
|
2019-08-29 06:12:09 +02:00
|
|
|
{
|
|
|
|
return $this->client->logo;
|
|
|
|
}
|
2019-08-29 06:13:16 +02:00
|
|
|
|
2019-08-30 08:16:39 +02:00
|
|
|
public function companyName()
|
2019-08-29 06:13:16 +02:00
|
|
|
{
|
2019-09-02 07:08:26 +02:00
|
|
|
return $this->company->present()->name();
|
2019-08-29 06:13:16 +02:00
|
|
|
}
|
|
|
|
|
2019-08-30 08:16:39 +02:00
|
|
|
public function companyAddress()
|
2019-08-29 06:13:16 +02:00
|
|
|
{
|
|
|
|
return $this->company->present()->address();
|
|
|
|
}
|
2019-08-30 08:16:39 +02:00
|
|
|
|
2019-08-29 06:07:04 +02:00
|
|
|
}
|