mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 04:17:34 -05:00 
			
		
		
		
	Improve invoice tests
This commit is contained in:
		
							parent
							
								
									fe3fbeb9cc
								
							
						
					
					
						commit
						a43b613e10
					
				@ -498,8 +498,6 @@ class InvoiceRepository extends BaseRepository
 | 
				
			|||||||
            if ($invoice->is_amount_discount) {
 | 
					            if ($invoice->is_amount_discount) {
 | 
				
			||||||
                $total -= $invoice->discount;
 | 
					                $total -= $invoice->discount;
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                //$total *= (100 - $invoice->discount) / 100;
 | 
					 | 
				
			||||||
                //$total = round($total, 2);
 | 
					 | 
				
			||||||
                $discount = round($total * ($invoice->discount / 100), 2);
 | 
					                $discount = round($total * ($invoice->discount / 100), 2);
 | 
				
			||||||
                $total -= $discount;
 | 
					                $total -= $discount;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -253,7 +253,7 @@
 | 
				
			|||||||
		<thead>
 | 
							<thead>
 | 
				
			||||||
			<tr>
 | 
								<tr>
 | 
				
			||||||
				<th style="min-width:32px;" class="hide-border"></th>
 | 
									<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>
 | 
									<th style="width:100%">{{ $invoiceLabels['description'] }}</th>
 | 
				
			||||||
                @if ($account->showCustomField('custom_invoice_item_label1'))
 | 
					                @if ($account->showCustomField('custom_invoice_item_label1'))
 | 
				
			||||||
                    <th style="min-width:120px">{{ $account->custom_invoice_item_label1 }}</th>
 | 
					                    <th style="min-width:120px">{{ $account->custom_invoice_item_label1 }}</th>
 | 
				
			||||||
 | 
				
			|||||||
@ -28,6 +28,8 @@ class InvoiceCest
 | 
				
			|||||||
        $I->click('Save');
 | 
					        $I->click('Save');
 | 
				
			||||||
        $I->see($clientEmail);
 | 
					        $I->see($clientEmail);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $clientId = $I->grabFromCurrentUrl('~clients/(\d+)~');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $I->amOnPage('/tax_rates/create');
 | 
					        $I->amOnPage('/tax_rates/create');
 | 
				
			||||||
        $I->fillField(['name' => 'name'], $itemTaxName);
 | 
					        $I->fillField(['name' => 'name'], $itemTaxName);
 | 
				
			||||||
        $I->fillField(['name' => 'rate'], 21);
 | 
					        $I->fillField(['name' => 'rate'], 21);
 | 
				
			||||||
@ -38,18 +40,22 @@ class InvoiceCest
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $invoiceNumber = $I->grabAttributeFrom('#invoice_number', 'value');
 | 
					        $invoiceNumber = $I->grabAttributeFrom('#invoice_number', 'value');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // check tax and discount rounding
 | 
				
			||||||
        $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
 | 
					        $I->selectDropdown($I, $clientEmail, '.client_select .dropdown-toggle');
 | 
				
			||||||
        $I->selectDataPicker($I, '#invoice_date');
 | 
					        $I->selectDataPicker($I, '#invoice_date');
 | 
				
			||||||
        $I->selectDataPicker($I, '#due_date', '+ 15 day');
 | 
					        $I->selectDataPicker($I, '#due_date', '+ 15 day');
 | 
				
			||||||
        $I->fillField('#po_number', rand(100, 200));
 | 
					        $I->fillField('#po_number', rand(100, 200));
 | 
				
			||||||
        $I->fillField('#discount', 15);
 | 
					        $I->fillField('#discount', 15);
 | 
				
			||||||
 | 
					        $I->selectOption('#taxRateSelect1', $itemTaxName . ' 21%');
 | 
				
			||||||
        $this->fillItem($I, 1, 'Item', 'Notes', 64.50, 3);
 | 
					        $this->fillItem($I, 1, 'Item', 'Notes', 64.50, 3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $I->click('#saveButton');
 | 
					        $I->click('#saveButton');
 | 
				
			||||||
        $I->wait(1);
 | 
					        $I->wait(1);
 | 
				
			||||||
        $I->see($invoiceNumber);
 | 
					        $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;
 | 
					        $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->wantTo('clone an invoice');
 | 
				
			||||||
        $I->amOnPage('/invoices/1/clone');
 | 
					        $I->amOnPage('/invoices/1/clone');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user