Nachtrag Steuerzone - Tests angepasst
authorG. Richardson <information@kivitendo-premium.de>
Wed, 6 Aug 2014 07:13:12 +0000 (09:13 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Wed, 6 Aug 2014 07:13:12 +0000 (09:13 +0200)
t/db_helper/price_tax_calculator.t
t/db_helper/record_links.t

index b374f5e..4bf9ab8 100644 (file)
@@ -129,21 +129,21 @@ sub test_default_invoice_one_item_19_tax_not_included() {
   is($invoice->marge_percent,   17.4358974358974, "${title}: marge_percent");
 
   is_deeply(\%data, {
-    allocated                            => {},
-    amounts                              => {
-      $buchungsgruppe->income_accno_id_0 => {
-        amount                           => 5.85,
-        tax_id                           => $tax->id,
-        taxkey                           => 3,
+    allocated                                    => {},
+    amounts                                      => {
+      $buchungsgruppe->income_accno_id($taxzone) => {
+        amount                                   => 5.85,
+        tax_id                                   => $tax->id,
+        taxkey                                   => 3,
       },
     },
-    amounts_cogs                         => {},
-    assembly_items                       => [
+    amounts_cogs                                 => {},
+    assembly_items                               => [
       [],
     ],
-    exchangerate                         => 1,
-    taxes                                => {
-      $tax->chart_id                     => 1.11,
+    exchangerate                                 => 1,
+    taxes                                        => {
+      $tax->chart_id                             => 1.11,
     },
   }, "${title}: calculated data");
 }
@@ -193,27 +193,27 @@ sub test_default_invoice_two_items_19_7_tax_not_included() {
   is($invoice->marge_percent,    34.8943460879497, "${title}: marge_percent");
 
   is_deeply(\%data, {
-    allocated                             => {},
-    amounts                               => {
-      $buchungsgruppe->income_accno_id_0  => {
-        amount                            => 5.85,
-        tax_id                            => $tax->id,
-        taxkey                            => 3,
+    allocated                                     => {},
+    amounts                                       => {
+      $buchungsgruppe->income_accno_id($taxzone)  => {
+        amount                                    => 5.85,
+        tax_id                                    => $tax->id,
+        taxkey                                    => 3,
       },
-      $buchungsgruppe7->income_accno_id_0 => {
-        amount                            => 11.66,
-        tax_id                            => $tax7->id,
-        taxkey                            => 2,
+      $buchungsgruppe7->income_accno_id($taxzone) => {
+        amount                                    => 11.66,
+        tax_id                                    => $tax7->id,
+        taxkey                                    => 2,
       },
     },
-    amounts_cogs                          => {},
-    assembly_items                        => [
+    amounts_cogs                                  => {},
+    assembly_items                                => [
       [], [],
     ],
-    exchangerate                          => 1,
-    taxes                                 => {
-      $tax->chart_id                      => 1.11,
-      $tax7->chart_id                     => 0.82,
+    exchangerate                                  => 1,
+    taxes                                         => {
+      $tax->chart_id                              => 1.11,
+      $tax7->chart_id                             => 0.82,
     },
   }, "${title}: calculated data");
 }
@@ -295,21 +295,21 @@ sub test_default_invoice_three_items_sellprice_rounding_discount() {
   is($invoice->marge_percent,    62.007874015748,    "${title}: marge_percent");
 
   is_deeply(\%data, {
-    allocated                             => {},
-    amounts                               => {
-      $buchungsgruppe->income_accno_id_0  => {
-        amount                            => 15.24,
-        tax_id                            => $tax->id,
-        taxkey                            => 3,
+    allocated                                    => {},
+    amounts                                      => {
+      $buchungsgruppe->income_accno_id($taxzone) => {
+        amount                                   => 15.24,
+        tax_id                                   => $tax->id,
+        taxkey                                   => 3,
       },
     },
-    amounts_cogs                          => {},
-    assembly_items                        => [
+    amounts_cogs                                 => {},
+    assembly_items                               => [
       [], [], [],
     ],
-    exchangerate                          => 1,
-    taxes                                 => {
-      $tax->chart_id                      => 2.9,
+    exchangerate                                 => 1,
+    taxes                                        => {
+      $tax->chart_id                             => 2.9,
     },
   }, "${title}: calculated data");
 }
index e063b33..e7dd31b 100644 (file)
@@ -20,8 +20,9 @@ use SL::DB::Order;
 use SL::DB::DeliveryOrder;
 use SL::DB::Part;
 use SL::DB::Unit;
+use SL::DB::TaxZone;
 
-my ($customer, $currency_id, $buchungsgruppe, $employee, $vendor);
+my ($customer, $currency_id, $buchungsgruppe, $employee, $vendor, $taxzone);
 my ($link, $links, $o1, $o2, $d, $i);
 
 sub reset_state {
@@ -37,6 +38,7 @@ sub reset_state {
 
   $buchungsgruppe  = SL::DB::Manager::Buchungsgruppe->find_by(description => 'Standard 19%', %{ $params{buchungsgruppe} }) || croak "No accounting group";
   $employee        = SL::DB::Manager::Employee->current                                                                    || croak "No employee";
+  $taxzone         = SL::DB::Manager::TaxZone->find_by( description => 'Inland')                                           || croak "No taxzone";
 
   $currency_id     = $::instance_conf->get_currency_id;
 
@@ -61,7 +63,7 @@ sub new_order {
     currency_id => $currency_id,
     employee_id => $employee->id,
     salesman_id => $employee->id,
-    taxzone_id  => 0,
+    taxzone_id  => $taxzone->id,
     quotation   => 0,
     %params,
   )->save;
@@ -75,7 +77,7 @@ sub new_delivery_order {
     currency_id => $currency_id,
     employee_id => $employee->id,
     salesman_id => $employee->id,
-    taxzone_id  => 0,
+    taxzone_id  => $taxzone->id,
     %params,
   )->save;
 }
@@ -89,8 +91,8 @@ sub new_invoice {
     employee_id => $employee->id,
     salesman_id => $employee->id,
     gldate      => DateTime->today_local->to_kivitendo,
-    taxzone_id  => 0,
     invoice     => 1,
+    taxzone_id  => $taxzone->id,
     type        => 'invoice',
     %params,
   )->save;