mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 13:44:31 -04:00
Profit Loss report tests
This commit is contained in:
parent
defde9fd0a
commit
ad8a7f6766
@ -120,6 +120,84 @@ class ProfitAndLossReportTest extends TestCase
|
||||
$this->account->delete();
|
||||
}
|
||||
|
||||
public function testMultiCurrencyInvoiceIncome()
|
||||
{
|
||||
$this->buildData();
|
||||
|
||||
$settings = ClientSettings::defaults();
|
||||
$settings->currency_id = 2;
|
||||
|
||||
$client = Client::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_deleted' => 0,
|
||||
'settings' => $settings
|
||||
]);
|
||||
|
||||
|
||||
$client2 = Client::factory()->create([
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'is_deleted' => 0,
|
||||
]);
|
||||
|
||||
|
||||
Invoice::factory()->create([
|
||||
'client_id' => $client->id,
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'amount' => 10,
|
||||
'balance' => 10,
|
||||
'status_id' => 2,
|
||||
'total_taxes' => 1,
|
||||
'date' => now()->format('Y-m-d'),
|
||||
'terms' => 'nada',
|
||||
'discount' => 0,
|
||||
'tax_rate1' => 0,
|
||||
'tax_rate2' => 0,
|
||||
'tax_rate3' => 0,
|
||||
'tax_name1' => '',
|
||||
'tax_name2' => '',
|
||||
'tax_name3' => '',
|
||||
'uses_inclusive_taxes' => false,
|
||||
'exchange_rate' => 2
|
||||
]);
|
||||
|
||||
|
||||
Invoice::factory()->create([
|
||||
'client_id' => $client2->id,
|
||||
'user_id' => $this->user->id,
|
||||
'company_id' => $this->company->id,
|
||||
'amount' => 10,
|
||||
'balance' => 10,
|
||||
'status_id' => 2,
|
||||
'total_taxes' => 1,
|
||||
'date' => now()->format('Y-m-d'),
|
||||
'terms' => 'nada',
|
||||
'discount' => 0,
|
||||
'tax_rate1' => 0,
|
||||
'tax_rate2' => 0,
|
||||
'tax_rate3' => 0,
|
||||
'tax_name1' => '',
|
||||
'tax_name2' => '',
|
||||
'tax_name3' => '',
|
||||
'uses_inclusive_taxes' => false,
|
||||
'exchange_rate' => 1
|
||||
]);
|
||||
|
||||
|
||||
$pl = new ProfitLoss($this->company, $this->payload);
|
||||
$pl->build();
|
||||
|
||||
$this->assertEquals(13.5, $pl->getIncome());
|
||||
$this->assertEquals(1.5, $pl->getIncomeTaxes());
|
||||
|
||||
$this->account->delete();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function testSimpleInvoiceIncome()
|
||||
{
|
||||
$this->buildData();
|
||||
|
Loading…
x
Reference in New Issue
Block a user