Improve invoice tests

This commit is contained in:
Hillel Coren 2017-02-14 22:02:54 +02:00
parent fe3fbeb9cc
commit a43b613e10
3 changed files with 12 additions and 7 deletions

View File

@ -498,8 +498,6 @@ class InvoiceRepository extends BaseRepository
if ($invoice->is_amount_discount) {
$total -= $invoice->discount;
} else {
//$total *= (100 - $invoice->discount) / 100;
//$total = round($total, 2);
$discount = round($total * ($invoice->discount / 100), 2);
$total -= $discount;
}

View File

@ -253,7 +253,7 @@
<thead>
<tr>
<th style="min-width:32px;" class="hide-border"></th>
<th style="width:28%">{{ $invoiceLabels['item'] }}</th>
<th style="min-width:120px;width:26%">{{ $invoiceLabels['item'] }}</th>
<th style="width:100%">{{ $invoiceLabels['description'] }}</th>
@if ($account->showCustomField('custom_invoice_item_label1'))
<th style="min-width:120px">{{ $account->custom_invoice_item_label1 }}</th>

View File

@ -28,6 +28,8 @@ class InvoiceCest
$I->click('Save');
$I->see($clientEmail);
$clientId = $I->grabFromCurrentUrl('~clients/(\d+)~');
$I->amOnPage('/tax_rates/create');
$I->fillField(['name' => 'name'], $itemTaxName);
$I->fillField(['name' => 'rate'], 21);
@ -38,18 +40,22 @@ class InvoiceCest
$invoiceNumber = $I->grabAttributeFrom('#invoice_number', 'value');
// check tax and discount rounding
$I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
$I->selectDataPicker($I, '#invoice_date');
$I->selectDataPicker($I, '#due_date', '+ 15 day');
$I->fillField('#po_number', rand(100, 200));
$I->fillField('#discount', 15);
$I->selectOption('#taxRateSelect1', $itemTaxName . ' 21%');
$this->fillItem($I, 1, 'Item', 'Notes', 64.50, 3);
$I->click('#saveButton');
$I->wait(1);
$I->see($invoiceNumber);
//$I->see('199.01');
$I->see('199.01');
$I->amOnPage("/clients/{$clientId}#invoices");
$I->see('199.01');
}
/*
@ -87,7 +93,8 @@ class InvoiceCest
}
}
*/
private function createRecurringInvoice(AcceptanceTester $I)
public function createRecurringInvoice(AcceptanceTester $I)
{
$clientEmail = $this->faker->safeEmail;
@ -118,7 +125,7 @@ class InvoiceCest
}
private function cloneInvoice(AcceptanceTester $I)
public function cloneInvoice(AcceptanceTester $I)
{
$I->wantTo('clone an invoice');
$I->amOnPage('/invoices/1/clone');