mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 19:18:56 -05:00 
			
		
		
		
	* Remove unnecessary save() on invoice * Update copyright * Working on Credit Repository * Implement credits as a paymentable entity * Add credit_id to transformer * fix rules for update payment * Fix random deleted_at keys in transformers * Fix for password_protect check
		
			
				
	
	
		
			83 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://opensource.org/licenses/AAL
 | 
						|
 */
 | 
						|
 | 
						|
namespace App\Models\Presenters;
 | 
						|
 | 
						|
use App\Utils\Number;
 | 
						|
use App\Utils\Traits\MakesDates;
 | 
						|
 | 
						|
/**
 | 
						|
 * 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
 | 
						|
{
 | 
						|
    use MakesDates;
 | 
						|
 | 
						|
 | 
						|
    public function amount()
 | 
						|
    {
 | 
						|
        return Number::formatMoney($this->balance, $this->client);
 | 
						|
    }
 | 
						|
 | 
						|
    public function invoice_number()
 | 
						|
    {
 | 
						|
        if ($this->number != '') {
 | 
						|
            return $this->number;
 | 
						|
        } else {
 | 
						|
            return '';
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    public function clientName()
 | 
						|
    {
 | 
						|
        return $this->client->present()->name();
 | 
						|
    }
 | 
						|
 | 
						|
    public function address()
 | 
						|
    {
 | 
						|
        return $this->client->present()->address();
 | 
						|
    }
 | 
						|
 | 
						|
    public function shippingAddress()
 | 
						|
    {
 | 
						|
        return $this->client->present()->shipping_address();
 | 
						|
    }
 | 
						|
 | 
						|
    public function companyLogo()
 | 
						|
    {
 | 
						|
        return $this->company->logo;
 | 
						|
    }
 | 
						|
 | 
						|
    public function clientLogo()
 | 
						|
    {
 | 
						|
        return $this->client->logo;
 | 
						|
    }
 | 
						|
 | 
						|
    public function companyName()
 | 
						|
    {
 | 
						|
        return $this->company->present()->name();
 | 
						|
    }
 | 
						|
 | 
						|
    public function companyAddress()
 | 
						|
    {
 | 
						|
        return $this->company->present()->address();
 | 
						|
    }
 | 
						|
}
 |