projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Inventur: Typo in Übersetzung
[kivitendo-erp.git]
/
t
/
db_helper
/
price_tax_calculator.t
diff --git
a/t/db_helper/price_tax_calculator.t
b/t/db_helper/price_tax_calculator.t
index
0fa0fe5
..
c888401
100644
(file)
--- a/
t/db_helper/price_tax_calculator.t
+++ b/
t/db_helper/price_tax_calculator.t
@@
-10,6
+10,7
@@
use Data::Dumper;
use List::MoreUtils qw(uniq);
use Support::TestSetup;
use Test::Exception;
use List::MoreUtils qw(uniq);
use Support::TestSetup;
use Test::Exception;
+use SL::Dev::ALL qw(:ALL);
use SL::DB::Buchungsgruppe;
use SL::DB::Currency;
use SL::DB::Buchungsgruppe;
use SL::DB::Currency;
@@
-22,11
+23,12
@@
use SL::DB::Part;
use SL::DB::Unit;
use SL::DB::TaxZone;
use SL::DB::Unit;
use SL::DB::TaxZone;
-my ($customer,
$currency_id,
@parts, $buchungsgruppe, $buchungsgruppe7, $unit, $employee, $tax, $tax7, $taxzone);
+my ($customer, @parts, $buchungsgruppe, $buchungsgruppe7, $unit, $employee, $tax, $tax7, $taxzone);
sub clear_up {
SL::DB::Manager::Order->delete_all(all => 1);
SL::DB::Manager::DeliveryOrder->delete_all(all => 1);
sub clear_up {
SL::DB::Manager::Order->delete_all(all => 1);
SL::DB::Manager::DeliveryOrder->delete_all(all => 1);
+ SL::DB::Manager::InvoiceItem->delete_all(all => 1);
SL::DB::Manager::Invoice->delete_all(all => 1);
SL::DB::Manager::Part->delete_all(all => 1);
SL::DB::Manager::Customer->delete_all(all => 1);
SL::DB::Manager::Invoice->delete_all(all => 1);
SL::DB::Manager::Part->delete_all(all => 1);
SL::DB::Manager::Customer->delete_all(all => 1);
@@
-47,17
+49,14
@@
sub reset_state {
$tax7 = SL::DB::Manager::Tax->find_by(taxkey => 2, rate => 0.07) || croak "No tax for 7\%";
$taxzone = SL::DB::Manager::TaxZone->find_by( description => 'Inland') || croak "No taxzone";
$tax7 = SL::DB::Manager::Tax->find_by(taxkey => 2, rate => 0.07) || croak "No tax for 7\%";
$taxzone = SL::DB::Manager::TaxZone->find_by( description => 'Inland') || croak "No taxzone";
- $currency_id = $::instance_conf->get_currency_id;
-
- $customer = SL::DB::Customer->new(
+ $customer = new_customer(
name => 'Test Customer',
name => 'Test Customer',
- currency_id => $currency_id,
taxzone_id => $taxzone->id,
%{ $params{customer} }
)->save;
@parts = ();
taxzone_id => $taxzone->id,
%{ $params{customer} }
)->save;
@parts = ();
- push @parts,
SL::DB::Part->new
(
+ push @parts,
new_part
(
partnumber => 'T4254',
description => 'Fourty-two fifty-four',
lastcost => 1.93,
partnumber => 'T4254',
description => 'Fourty-two fifty-four',
lastcost => 1.93,
@@
-67,7
+66,7
@@
sub reset_state {
%{ $params{part1} }
)->save;
%{ $params{part1} }
)->save;
- push @parts,
SL::DB::Part->new
(
+ push @parts,
new_part
(
partnumber => 'T0815',
description => 'Zero EIGHT fifteeN @ 7%',
lastcost => 5.473,
partnumber => 'T0815',
description => 'Zero EIGHT fifteeN @ 7%',
lastcost => 5.473,
@@
-77,7
+76,7
@@
sub reset_state {
%{ $params{part2} }
)->save;
%{ $params{part2} }
)->save;
- push @parts,
SL::DB::Part->new
(
+ push @parts,
new_part
(
partnumber => 'T888',
description => 'Triple 8',
lastcost => 0,
partnumber => 'T888',
description => 'Triple 8',
lastcost => 0,
@@
-92,16
+91,8
@@
sub reset_state {
sub new_invoice {
my %params = @_;
sub new_invoice {
my %params = @_;
- return SL::DB::Invoice->new(
- customer_id => $customer->id,
- currency_id => $currency_id,
- employee_id => $employee->id,
- salesman_id => $employee->id,
- gldate => DateTime->today_local->to_kivitendo,
+ return create_sales_invoice(
taxzone_id => $taxzone->id,
taxzone_id => $taxzone->id,
- transdate => DateTime->today_local->to_kivitendo,
- invoice => 1,
- type => 'invoice',
%params,
);
}
%params,
);
}
@@
-111,12
+102,8
@@
sub new_item {
my $part = delete($params{part}) || $parts[0];
my $part = delete($params{part}) || $parts[0];
- return SL::DB::InvoiceItem->new(
- parts_id => $part->id,
- lastcost => $part->lastcost,
- sellprice => $part->sellprice,
- description => $part->description,
- unit => $part->unit,
+ return create_invoice_item(
+ part => $part,
%params,
);
}
%params,
);
}
@@
-124,7
+111,7
@@
sub new_item {
sub test_default_invoice_one_item_19_tax_not_included() {
reset_state();
sub test_default_invoice_one_item_19_tax_not_included() {
reset_state();
- my $item
= new_item(qty => 2.5);
+ my $item = new_item(qty => 2.5);
my $invoice = new_invoice(
taxincluded => 0,
invoiceitems => [ $item ],
my $invoice = new_invoice(
taxincluded => 0,
invoiceitems => [ $item ],
@@
-177,6
+164,7
@@
sub test_default_invoice_one_item_19_tax_not_included() {
taxkey_id => $taxkey->id,
},
],
taxkey_id => $taxkey->id,
},
],
+ rounding => 0,
}, "${title}: calculated data");
}
}, "${title}: calculated data");
}
@@
-264,6
+252,7
@@
sub test_default_invoice_two_items_19_7_tax_not_included() {
taxkey_id => $taxkey2->id,
},
],
taxkey_id => $taxkey2->id,
},
],
+ rounding => 0,
}, "${title}: calculated data");
}
}, "${title}: calculated data");
}
@@
-382,6
+371,7
@@
sub test_default_invoice_three_items_sellprice_rounding_discount() {
taxkey_id => $taxkeys{$item3->parts_id}->id,
}
],
taxkey_id => $taxkeys{$item3->parts_id}->id,
}
],
+ rounding => 0,
}, "${title}: calculated data");
}
}, "${title}: calculated data");
}
@@
-445,6
+435,7
@@
sub test_default_invoice_one_item_19_tax_not_included_rounding_discount() {
taxkey_id => $taxkeys{$item->parts_id}->id,
},
],
taxkey_id => $taxkeys{$item->parts_id}->id,
},
],
+ rounding => 0,
}, "${title}: calculated data");
}
}, "${title}: calculated data");
}