commit 14d71a6d1215e4fc67136c060fd21cd6c59602af
Author: Sven Schöling <s.schoeling@googlemail.com>
Date:   Wed Dec 30 12:51:33 2015 +0100

    Erfolgsrechnung: von pos_eur auf pos_er gelegt.

diff --git a/SL/AM.pm b/SL/AM.pm
index cbbfae03f..2cf6a43f1 100644
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -59,7 +59,7 @@ sub get_account {
   my $dbh = $form->dbconnect($myconfig);
   my $query = qq{
     SELECT c.accno, c.description, c.charttype, c.category,
-      c.link, c.pos_bilanz, c.pos_eur, c.new_chart_id, c.valid_from,
+      c.link, c.pos_bilanz, c.pos_eur, c.pos_er, c.new_chart_id, c.valid_from,
       c.pos_bwa, datevautomatik,
       tk.taxkey_id, tk.pos_ustva, tk.tax_id,
       tk.tax_id || '--' || tk.taxkey_id AS tax, tk.startdate
@@ -301,6 +301,7 @@ sub save_account {
                   pos_bwa   = ?,
                   pos_bilanz = ?,
                   pos_eur = ?,
+                  pos_er = ?,
                   new_chart_id = ?,
                   valid_from = ?,
                   datevautomatik = ?
@@ -315,6 +316,7 @@ sub save_account {
                   conv_i($form->{pos_bwa}),
                   conv_i($form->{pos_bilanz}),
                   conv_i($form->{pos_eur}),
+                  conv_i($form->{pos_er}),
                   conv_i($form->{new_chart_id}),
                   conv_date($form->{valid_from}),
                   ($form->{datevautomatik} eq 'T') ? 'true':'false',
diff --git a/SL/DB/MetaSetup/Chart.pm b/SL/DB/MetaSetup/Chart.pm
index 865296e47..993fd0d56 100644
--- a/SL/DB/MetaSetup/Chart.pm
+++ b/SL/DB/MetaSetup/Chart.pm
@@ -21,6 +21,7 @@ __PACKAGE__->meta->columns(
   new_chart_id   => { type => 'integer' },
   pos_bilanz     => { type => 'integer' },
   pos_bwa        => { type => 'integer' },
+  pos_er         => { type => 'integer' },
   pos_eur        => { type => 'integer' },
   taxkey_id      => { type => 'integer' },
   valid_from     => { type => 'date' },
diff --git a/SL/RP.pm b/SL/RP.pm
index 09c8d1c3f..0b4dea9ec 100644
--- a/SL/RP.pm
+++ b/SL/RP.pm
@@ -1917,9 +1917,9 @@ sub get_accounts_ch {
   my ($inclusion);
 
   if ($category eq 'I') {
-    $inclusion = "AND pos_eur = NULL OR pos_eur > '0' AND pos_eur <= '5'";
+    $inclusion = "AND pos_er = NULL OR pos_er > '0' AND pos_er <= '5'";
   } elsif ($category eq 'E') {
-    $inclusion = "AND pos_eur = NULL OR pos_eur >= '6' AND pos_eur < '100'";
+    $inclusion = "AND pos_er = NULL OR pos_er >= '6' AND pos_er < '100'";
   } else {
     $inclusion = "";
   }
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index 392aedcda..8233b55d3 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -214,47 +214,38 @@ sub account_header {
   }
 
   my $select_eur = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
-  my %eur;
-  if (($form->{country_mode} = SL::DB::Default->get->country_mode) eq 'CH') {
-    %eur = (
-         1  => "Ertrag",
-         6  => "Aufwand",
-    );
-  } else {
-    %eur = (
-         1  => "Umsatzerlöse",
-         2  => "sonstige Erlöse",
-         3  => "Privatanteile",
-         4  => "Zinserträge",
-         5  => "Ausserordentliche Erträge",
-         6  => "Vereinnahmte Umsatzst.",
-         7  => "Umsatzsteuererstattungen",
-         8  => "Wareneingänge",
-         9  => "Löhne und Gehälter",
-         10 => "Gesetzl. sozialer Aufw.",
-         11 => "Mieten",
-         12 => "Gas, Strom, Wasser",
-         13 => "Instandhaltung",
-         14 => "Steuern, Versich., Beiträge",
-         15 => "Kfz-Steuern",
-         16 => "Kfz-Versicherungen",
-         17 => "Sonst. Fahrzeugkosten",
-         18 => "Werbe- und Reisekosten",
-         19 => "Instandhaltung u. Werkzeuge",
-         20 => "Fachzeitschriften, Bücher",
-         21 => "Miete für Einrichtungen",
-         22 => "Rechts- und Beratungskosten",
-         23 => "Bürobedarf, Porto, Telefon",
-         24 => "Sonstige Aufwendungen",
-         25 => "Abschreibungen auf Anlagever.",
-         26 => "Abschreibungen auf GWG",
-         27 => "Vorsteuer",
-         28 => "Umsatzsteuerzahlungen",
-         29 => "Zinsaufwand",
-         30 => "Ausserordentlicher Aufwand",
-         31 => "Betriebliche Steuern",
-    );
-  }
+  my %eur = (
+          1  => "Umsatzerlöse",
+          2  => "sonstige Erlöse",
+          3  => "Privatanteile",
+          4  => "Zinserträge",
+          5  => "Ausserordentliche Erträge",
+          6  => "Vereinnahmte Umsatzst.",
+          7  => "Umsatzsteuererstattungen",
+          8  => "Wareneingänge",
+          9  => "Löhne und Gehälter",
+          10 => "Gesetzl. sozialer Aufw.",
+          11 => "Mieten",
+          12 => "Gas, Strom, Wasser",
+          13 => "Instandhaltung",
+          14 => "Steuern, Versich., Beiträge",
+          15 => "Kfz-Steuern",
+          16 => "Kfz-Versicherungen",
+          17 => "Sonst. Fahrzeugkosten",
+          18 => "Werbe- und Reisekosten",
+          19 => "Instandhaltung u. Werkzeuge",
+          20 => "Fachzeitschriften, Bücher",
+          21 => "Miete für Einrichtungen",
+          22 => "Rechts- und Beratungskosten",
+          23 => "Bürobedarf, Porto, Telefon",
+          24 => "Sonstige Aufwendungen",
+          25 => "Abschreibungen auf Anlagever.",
+          26 => "Abschreibungen auf GWG",
+          27 => "Vorsteuer",
+          28 => "Umsatzsteuerzahlungen",
+          29 => "Zinsaufwand",
+          30 => "Ausserordentlicher Aufwand",
+          31 => "Betriebliche Steuern");
   foreach my $item (sort({ $a <=> $b } keys(%eur))) {
     my $text = H($::locale->{iconv_utf8}->convert($eur{$item}));
     if ($item == $form->{pos_eur}) {
@@ -265,6 +256,20 @@ sub account_header {
 
   }
 
+  my $select_er = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
+  my %er = (
+       1  => "Ertrag",
+       6  => "Aufwand");
+  foreach my $item (sort({ $a <=> $b } keys(%er))) {
+    my $text = H($::locale->{iconv_utf8}->convert($eur{$item}));
+    if ($item == $form->{pos_er}) {
+      $select_er .= qq|<option value=$item selected>|. sprintf("%.2d", $item) .qq|. $text</option>\n|;
+    } else {
+      $select_er .= qq|<option value=$item>|. sprintf("%.2d", $item) .qq|. $text</option>\n|;
+    }
+
+  }
+
   my $select_bwa = q|<option value=""> |. $locale->text('None') .q|</option>\n|;
 
   my %bwapos = (
@@ -367,6 +372,7 @@ sub account_header {
     select_bwa                 => $select_bwa,
     select_bilanz              => $select_bilanz,
     select_eur                 => $select_eur,
+    select_er                  => $select_er,
   };
 
   # Ausgabe des Templates
diff --git a/sql/Pg-upgrade2/chart_pos_er.sql b/sql/Pg-upgrade2/chart_pos_er.sql
new file mode 100644
index 000000000..92c9abb42
--- /dev/null
+++ b/sql/Pg-upgrade2/chart_pos_er.sql
@@ -0,0 +1,6 @@
+-- @tag: chart_pos_er
+-- @description: pos_er Feld in Konten für die Position ind er Erfolgsrechnung
+-- @depends: release_3_3_0
+-- @encoding: utf-8
+
+ALTER TABLE chart ADD COLUMN pos_er INTEGER;
diff --git a/sql/Switzerland-deutsch-MWST-2014-chart.sql b/sql/Switzerland-deutsch-MWST-2014-chart.sql
index 3fab61a7b..e7474e1f3 100644
--- a/sql/Switzerland-deutsch-MWST-2014-chart.sql
+++ b/sql/Switzerland-deutsch-MWST-2014-chart.sql
@@ -5,7 +5,7 @@
 
 DELETE FROM chart;
 
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik, valid_from) VALUES
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_er, datevautomatik, valid_from) VALUES
 ('1',    'AKTIVEN','H','','','1',0,NULL,NULL,NULL,NULL,FALSE,'2011-01-01 00:00:00.000000'),
 ('10',   'UMLAUFSVERMÖGEN','H','','','10',0,NULL,NULL,NULL,NULL,FALSE,'2011-01-01 00:00:00.000000'),
 ('100',  'Flüssige Mittel','H','','','100',0,NULL,NULL,NULL,NULL,FALSE,'2011-01-01 00:00:00.000000'),
diff --git a/sql/Switzerland-deutsch-ohneMWST-2014-chart.sql b/sql/Switzerland-deutsch-ohneMWST-2014-chart.sql
index 50165e9f7..31d1b0e37 100644
--- a/sql/Switzerland-deutsch-ohneMWST-2014-chart.sql
+++ b/sql/Switzerland-deutsch-ohneMWST-2014-chart.sql
@@ -5,7 +5,7 @@
 
 DELETE FROM chart;
 
-INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_eur, datevautomatik, valid_from) VALUES
+INSERT INTO chart (accno, description, charttype, category, link, gifi_accno, taxkey_id, pos_ustva, pos_bwa, pos_bilanz, pos_er, datevautomatik, valid_from) VALUES
 ('1',    'AKTIVEN','H','','','1',0,NULL,NULL,NULL,NULL,FALSE,'2011-01-01 00:00:00.000000'),
 ('10',   'UMLAUFSVERMÖGEN','H','','','10',0,NULL,NULL,NULL,NULL,FALSE,'2011-01-01 00:00:00.000000'),
 ('100',  'Flüssige Mittel','H','','','100',0,NULL,NULL,NULL,NULL,FALSE,'2011-01-01 00:00:00.000000'),
diff --git a/templates/webpages/am/edit_accounts.html b/templates/webpages/am/edit_accounts.html
index 7b000d674..12a284c25 100644
--- a/templates/webpages/am/edit_accounts.html
+++ b/templates/webpages/am/edit_accounts.html
@@ -217,9 +217,7 @@ $(function() {
               <tr>
                 <th align="left">[% 'Taxkey' | $T8 %]</th>
                 <th align="left">[% 'valid from' | $T8 %]</th>
-                [% IF country_mode != 'CH' %]
-                  <th align="left">[% 'pos_ustva' | $T8 %]</th>
-                [% END %]
+                <th align="left">[% 'pos_ustva' | $T8 %]</th>
                 <th align="left">[% 'delete' | $T8 %] ? </th>
               </tr>
 [% FOREACH tk = ACCOUNT_TAXKEYS %]
@@ -229,18 +227,14 @@ $(function() {
                 <input type="hidden" name="taxkey_id_[% tk.runningnumber %]" value="[% tk.id %]">
                 <td><select name="taxkey_tax_[% tk.runningnumber %]">[% tk.selecttaxkey %]</select></td>
                 <td><input name="taxkey_startdate_[% tk.runningnumber %]" value="[% HTML.escape(tk.startdate) %]"></td>
-                [% IF country_mode != 'CH' %]
-                  <td><select name="taxkey_pos_ustva_[% tk.runningnumber %]">[% tk.select_tax %]</select></td>
-                [% END %]
+                <td><select name="taxkey_pos_ustva_[% tk.runningnumber %]">[% tk.select_tax %]</select></td>
                 <td><input name="taxkey_del_[% tk.runningnumber %]" type="checkbox"
                 class="checkbox" value="delete"></td>
     [% ELSE %]
                 <input type="hidden" name="taxkey_id_[% tk.runningnumber %]" value="NEW">
                 <td><select name="taxkey_tax_[% tk.runningnumber %]">[% tk.selecttaxkey %]</select></td>
                 <td><input name="taxkey_startdate_[% tk.runningnumber %]" value="[% HTML.escape(tk.startdate) %]"></td>
-                [% IF country_mode != 'CH' %]
-                  <td><select name="taxkey_pos_ustva_[% tk.runningnumber %]">[% tk.select_tax %]</select></td>
-                [% END %]
+                <td><select name="taxkey_pos_ustva_[% tk.runningnumber %]">[% tk.select_tax %]</select></td>
                 <td>&nbsp;</td>
     [% END %]
               </tr>
@@ -257,7 +251,10 @@ $(function() {
           <th align="left">[% 'EUER' | $T8 %]</th>
           <td colspan="3"><select name="pos_eur">[% select_eur %]</select></td>
         </tr>
-     [% IF country_mode != 'CH' %]
+        <tr>
+          <th align="left">[% 'Erfolgsrechnung' | $T8 %]</th>
+          <td colspan="3"><select name="pos_er">[% select_er %]</select></td>
+        </tr>
         <tr>
           <th align="left">[% 'BWA' | $T8 %]</th>
           <td colspan="3"><select name="pos_bwa">[% select_bwa %]</select></td>
@@ -271,7 +268,6 @@ $(function() {
           <th align="left">[% 'Datevautomatik' | $T8 %]</th>
           <td colspan="3"><input name="datevautomatik" type="checkbox" class="checkbox" value="T" [% IF datevautomatik %]checked [% END %]>[% 'If checked the taxkey will not be exported in the DATEV Export, but only IF chart taxkeys differ from general ledger taxkeys' | $T8 %] </td>
         </tr>
-     [% END %]
         <tr>
           <th align="left">[% 'Folgekonto' | $T8 %]</th>
           <td><select name="new_chart_id">[% selectnewaccount %]</select></td>
