Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e82db1a7

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID e82db1a7b5f8cfce019012e60a689c9142851a63
  • Vorgänger a693e5f4
  • Nachfolger 99d05c2c

Filtert Steuern bei Dialogbuchungen

Bei Dialogbuchungen kam es in der Vergangenheit zu Verwechslungen
von Umsatz- und Vorsteuer. Für jedes Konto werden daher nun Steuern
nur noch angezeigt, wenn die Steuer so eingestellt ist, dass sie
für die Kontoart des ausgewählten Kontos angezeigt wird.

Implementiert #2249.

Unterschiede anzeigen:

SL/AM.pm
1777 1777
                   taxdescription,
1778 1778
                   round(rate * 100, 2) AS rate,
1779 1779
                   chart_id,
1780
                   chart_categories,
1780 1781
                   (id IN (SELECT tax_id
1781 1782
                           FROM acc_trans)) AS tax_already_used
1782 1783
                 FROM tax
......
1834 1835

  
1835 1836
  $form->{rate} = $form->{rate} / 100;
1836 1837

  
1837
  my @values = ($form->{taxkey}, $form->{taxdescription}, $form->{rate}, $form->{chart_id}, $form->{chart_id} );
1838
  my $chart_categories = '';
1839
  $chart_categories .= 'A' if $form->{asset};
1840
  $chart_categories .= 'L' if $form->{liability};
1841
  $chart_categories .= 'Q' if $form->{equity};
1842
  $chart_categories .= 'I' if $form->{revenue};
1843
  $chart_categories .= 'E' if $form->{expense};
1844
  $chart_categories .= 'C' if $form->{costs};
1845

  
1846
  my @values = ($form->{taxkey}, $form->{taxdescription}, $form->{rate}, $form->{chart_id}, $form->{chart_id}, $chart_categories);
1838 1847
  if ($form->{id} ne "") {
1839 1848
    $query = qq|UPDATE tax SET
1840 1849
                  taxkey         = ?,
1841 1850
                  taxdescription = ?,
1842 1851
                  rate           = ?,
1843 1852
                  chart_id       = ?,
1844
                  taxnumber      = (SELECT accno FROM chart WHERE id= ? )
1853
                  taxnumber      = (SELECT accno FROM chart WHERE id= ? ),
1854
                  chart_categories = ?
1845 1855
                WHERE id = ?|;
1846 1856
    push(@values, $form->{id});
1847 1857

  
......
1852 1862
                  taxdescription,
1853 1863
                  rate,
1854 1864
                  chart_id,
1855
                  taxnumber
1865
                  taxnumber,
1866
                  chart_categories
1856 1867
                )
1857
                VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?) )|;
1868
                VALUES (?, ?, ?, ?, (SELECT accno FROM chart WHERE id = ?), ? )|;
1858 1869
  }
1859 1870
  do_query($form, $dbh, $query, @values);
1860 1871

  
SL/GL.pm
801 801
  $main::lxdebug->leave_sub();
802 802
}
803 803

  
804
sub get_tax_dropdown {
805
  my $myconfig = \%main::myconfig;
806
  my $form = $main::form;
807

  
808
  my $dbh = $form->get_standard_dbh($myconfig);
809

  
810
  my $query = qq|SELECT category FROM chart WHERE accno = ?|;
811
  my ($category) = selectrow_query($form, $dbh, $query, $form->{accno});
812

  
813
  $query = qq|SELECT * FROM tax WHERE chart_categories like '%$category%' order by taxkey, rate|;
814

  
815
  my $sth = prepare_execute_query($form, $dbh, $query);
816

  
817
  $form->{TAX_ACCOUNTS} = [];
818
  while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
819
    push(@{ $form->{TAX_ACCOUNTS} }, $ref);
820
  }
821

  
822
}
804 823

  
805 824
1;
bin/mozilla/am.pl
1461 1461

  
1462 1462
  _get_taxaccount_selection();
1463 1463

  
1464
  $form->{asset}      = 1;
1465
  $form->{liability}  = 1;
1466
  $form->{equity}     = 1;
1467
  $form->{revenue}    = 1;
1468
  $form->{expense}    = 1;
1469
  $form->{costs}      = 1;
1470

  
1464 1471
  $form->header();
1465 1472

  
1466 1473
  my $parameters_ref = {
......
1485 1492
  $form->{title} =  $locale->text('Edit');
1486 1493

  
1487 1494
  AM->get_tax(\%myconfig, \%$form);
1495

  
1488 1496
  _get_taxaccount_selection();
1489 1497

  
1498
  $form->{asset}      = $form->{chart_categories} =~ 'A' ? 1 : 0;
1499
  $form->{liability}  = $form->{chart_categories} =~ 'L' ? 1 : 0;
1500
  $form->{equity}     = $form->{chart_categories} =~ 'Q' ? 1 : 0;
1501
  $form->{revenue}    = $form->{chart_categories} =~ 'I' ? 1 : 0;
1502
  $form->{expense}    = $form->{chart_categories} =~ 'E' ? 1 : 0;
1503
  $form->{costs}      = $form->{chart_categories} =~ 'C' ? 1 : 0;
1504

  
1490 1505
  $form->{rate} = $form->format_amount(\%myconfig, $form->{rate}, 2);
1491 1506

  
1492 1507
  $form->header();
bin/mozilla/gl.pl
686 686
  my %taxchart_labels = ();
687 687
  my @taxchart_values = ();
688 688
  my %taxcharts = ();
689
  foreach my $item (@{ $form->{ALL_TAXCHARTS} }) {
689
  foreach my $item (@{ $form->{TAX_ACCOUNTS} }) {
690 690
    my $key = $item->{id} . "--" . $item->{rate};
691 691
    $taxchart_init = $key if ($taxchart_init == $item->{id});
692 692
    push(@taxchart_values, $key);
......
730 730
    my $accno = qq|<td>| .
731 731
      NTI($cgi->popup_menu('-name' => "accno_$i",
732 732
                           '-id' => "accno_$i",
733
                           '-onChange' => "setTaxkey($i)",
733
                           '-onChange' => "updateTaxes($i);",
734 734
                           '-style' => 'width:200px',
735 735
                           '-values' => \@chart_values,
736 736
                           '-labels' => \%chart_labels,
......
862 862
                                    "all"       => 0,
863 863
                                    "old_id"    => \@old_project_ids },
864 864
                   "charts"    => { "key"       => "ALL_CHARTS",
865
                                    "transdate" => $::form->{transdate} },
866
                   "taxcharts" => "ALL_TAXCHARTS");
865
                                    "transdate" => $::form->{transdate} });
866

  
867
  $::form->{accno} = $::form->{ALL_CHARTS}[0]->{accno};
868
  GL->get_tax_dropdown();
867 869

  
868 870
  GL->get_chart_balances('charts' => $::form->{ALL_CHARTS});
869 871

  
......
1219 1221
  call_sub($main::form->{nextsub});
1220 1222
}
1221 1223

  
1224
sub get_tax_dropdown {
1225

  
1226
  my $form = $main::form;
1227
  $main::lxdebug->enter_sub();
1228
  GL->get_tax_dropdown();
1229

  
1230
  foreach my $item (@{ $form->{TAX_ACCOUNTS} }) {
1231
    $item->{taxdescription} = $::locale->{iconv_utf8}->convert($item->{taxdescription});
1232
    $item->{taxdescription} .= ' ' . $form->round_amount($item->{rate} * 100);
1233
  }
1234

  
1235
  print $form->ajax_response_header, $form->parse_html_template("gl/update_tax_accounts");
1236

  
1237
  $main::lxdebug->leave_sub();
1238

  
1239
}
1240

  
1222 1241
1;
locale/de/all
97 97
  'Account Nummer'              => 'Kontonummer',
98 98
  'Account Type'                => 'Kontoart',
99 99
  'Account Type missing!'       => 'Kontoart fehlt!',
100
  'Account categories'          => 'Kontoarten',
100 101
  'Account deleted!'            => 'Konto gelöscht!',
101 102
  'Account for fees'            => 'Konto f&uuml;r Geb&uuml;hren',
102 103
  'Account for interest'        => 'Konto f&uuml;r Zinsen',
templates/webpages/am/edit_tax.html
1 1
[%- USE T8 %]
2 2
[%- USE HTML %]
3
[%- USE L %]
3 4
 <form method="post" action="am.pl">
4 5
  <input type="hidden" name="id" value="[% HTML.escape(id) %]">
5 6
  <input type="hidden" name="type" value="tax">
......
33 34
    <td><select name="chart_id"><option value="0">[% 'None' | $T8 %]</option>[% FOREACH row = ACCOUNTS %]<option value="[% HTML.escape(row.id) %]" [% IF row.selected %]selected[% END %]>[% HTML.escape(row.taxaccount) %]</option>[% END %]</select></td>
34 35
   </tr>
35 36

  
37
    <td>[% 'Account categories' | $T8 %]</td>
38
    <td><table>
39
          <colgroup>
40
            <col width="10">
41
            <col width="130">
42
            <col width="10">
43
            <col width="130">
44
            <col width="10">
45
            <col width="130">
46
            <col width="10">
47
            <col width="130">
48
            <col width="10">
49
            <col width="130">
50
            <col width="10">
51
            <col width="130">
52
          </colgroup>
53
          <tr>
54
            <td align="right">[% IF asset %]
55
                                [% L.checkbox_tag('asset', value => 1, checked => 1, class => 'checkbox') %]
56
                              [% ELSE %]
57
                                [% L.checkbox_tag('asset', value => 1, checked => 0, class => 'checkbox') %]
58
                              [% END %]
59
            </td>
60
            <td align="left">[% 'Asset' | $T8 %] (A)</td>
61
            <td align="right">[% IF liability %]
62
                                [% L.checkbox_tag('liability', value => 1, checked => 1, class => 'checkbox') %]
63
                              [% ELSE %]
64
                                [% L.checkbox_tag('liability', value => 1, checked => 0, class => 'checkbox') %]
65
                              [% END %]
66
            </td>
67
            <td align="left">[% 'Liability' | $T8 %] (L)</td>
68
            <td align="right">[% IF equity %]
69
                                [% L.checkbox_tag('equity', value => 1, checked => 1, class => 'checkbox') %]
70
                              [% ELSE %]
71
                                [% L.checkbox_tag('equity', value => 1, checked => 0, class => 'checkbox') %]
72
                              [% END %]
73
            </td>
74
            <td align="left">[% 'Equity' | $T8 %] (Q)</td>
75
            <td align="right">[% IF revenue %]
76
                                [% L.checkbox_tag('revenue', value => 1, checked => 1, class => 'checkbox') %]
77
                              [% ELSE %]
78
                                [% L.checkbox_tag('revenue', value => 1, checked => 0, class => 'checkbox') %]
79
                              [% END %]
80
            </td>
81
            <td align="left">[% 'Revenue' | $T8 %] (I)</td>
82
            <td align="right">[% IF expense %]
83
                                [% L.checkbox_tag('expense', value => 1, checked => 1, class => 'checkbox') %]
84
                              [% ELSE %]
85
                                [% L.checkbox_tag('expense', value => 1, checked => 0, class => 'checkbox') %]
86
                              [% END %]
87
            </td>
88
            <td align="left">[% 'Expense' | $T8 %] (E)</td>
89
            <td align="right">[% IF costs %]
90
                                [% L.checkbox_tag('costs', value => 1, checked => 1, class => 'checkbox') %]
91
                              [% ELSE %]
92
                                [% L.checkbox_tag('costs', value => 1, checked => 0, class => 'checkbox') %]
93
                              [% END %]
94
            </td>
95
            <td align="left">[% 'Costs' | $T8 %] (C)</td>
96
          </tr>
97
        </table>
98
     </td>
99
   </tr>
100

  
101
  </table>
36 102
  </table>
37 103

  
38 104
  [% UNLESS orphaned %]
templates/webpages/gl/form_header.html
4 4
[%- USE L %]
5 5
<script type="text/javascript">
6 6
  <!--
7
  function setTaxkey(row) {
8
    var accno  = document.getElementById('accno_' + row);
9
    var taxkey = accno.options[accno.selectedIndex].value;
10
    var reg = /--([0-9]*)/;
11
    var found = reg.exec(taxkey);
12
    var index = found[1];
13
    index = parseInt(index);
14
    var tax = 'taxchart_' + row;
15
    for (var i = 0; i < document.getElementById(tax).options.length; ++i) {
16
      var reg2 = new RegExp("^"+ index, "");
17
      if (reg2.exec(document.getElementById(tax).options[i].value)) {
18
        document.getElementById(tax).options[i].selected = true;
19
        break;
20
      }
7
function updateTaxes(row)
8
{
9
  var accno  = document.getElementById('accno_' + row);
10
  var taxkey = accno.options[accno.selectedIndex].value;
11
  var reg = /--([0-9]*)/;
12
  var found = reg.exec(taxkey);
13
  var index = found[1];
14
  index = parseInt(index);
15
  var tax = 'taxchart_' + row;
16
  var taxkeyposition = taxkey.lastIndexOf(found[0]);
17
  var account = taxkey.substr(0, taxkeyposition);
18

  
19
  var xmlhttp;
20
  if (window.XMLHttpRequest)
21
  {// code for IE7+, Firefox, Chrome, Opera, Safari
22
    xmlhttp=new XMLHttpRequest();
23
  }
24
  else
25
  {// code for IE6, IE5
26
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
27
  }
28
  xmlhttp.onreadystatechange=function()
29
  {
30
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
31
    {
32
      var element = document.getElementById("taxchart_" + row);
33
      element.innerHTML = xmlhttp.responseText;
21 34
    }
22
  };
35
  }
36
  xmlhttp.open("GET","gl.pl?action=get_tax_dropdown&accno=" + account + "&select_index=" + index,true);
37
  xmlhttp.send();
38
};
23 39

  
24 40
  function copy_debit_to_credit() {
25 41
    var txt = document.getElementsByName('debit_1')[0].value;
templates/webpages/gl/update_tax_accounts.html
1
[% FOR row = TAX_ACCOUNTS %]
2
<option value='[% row.id %]--[% row.rate %]' [% IF row.id == select_index %]selected[% END %]>[% row.taxdescription %] %</option>
3
[% END %]

Auch abrufbar als: Unified diff