Revision 6e603868
Von Kivitendo Admin vor mehr als 10 Jahren hinzugefügt
SL/Controller/Buchungsgruppen.pm | ||
---|---|---|
25 | 25 |
my ($self) = @_; |
26 | 26 |
|
27 | 27 |
my $buchungsgruppen = SL::DB::Manager::Buchungsgruppe->get_all_sorted(); |
28 |
my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); |
|
28 |
my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(query => [ obsolete => 0 ]);
|
|
29 | 29 |
|
30 | 30 |
my %chartlist = (); |
31 | 31 |
foreach my $gruppe (@{ $buchungsgruppen }) { |
... | ... | |
59 | 59 |
sub action_edit { |
60 | 60 |
my ($self) = @_; |
61 | 61 |
|
62 |
# check whether buchungsgruppe is assigned to any parts |
|
63 |
my $number_of_parts_with_buchungsgruppe = SL::DB::Manager::Part->get_objects_count(where => [ buchungsgruppen_id => $self->config->id]); |
|
64 |
|
|
62 | 65 |
$self->show_form(title => t8('Edit Buchungsgruppe'), |
66 |
linked_parts => $number_of_parts_with_buchungsgruppe, |
|
63 | 67 |
CHARTLIST => SL::DB::TaxzoneChart->get_all_accounts_by_buchungsgruppen_id($self->config->id)); |
64 | 68 |
} |
65 | 69 |
|
... | ... | |
120 | 124 |
|
121 | 125 |
$self->config->save; |
122 | 126 |
|
123 |
#Save taxzone_charts: |
|
124 |
if ($is_new) { |
|
127 |
# check whether there are any assigned parts |
|
128 |
my $number_of_parts_with_buchungsgruppe = SL::DB::Manager::Part->get_objects_count(where => [ buchungsgruppen_id => $self->config->id]); |
|
129 |
|
|
130 |
# Save or update taxzone_charts: |
|
131 |
if ($is_new or $number_of_parts_with_buchungsgruppe == 0) { |
|
125 | 132 |
my $taxzones = SL::DB::Manager::TaxZone->get_all_sorted(); |
126 | 133 |
|
127 | 134 |
foreach my $tz (@{ $taxzones }) { |
SL/Controller/Taxzones.pm | ||
---|---|---|
54 | 54 |
sub action_edit { |
55 | 55 |
my ($self) = @_; |
56 | 56 |
|
57 |
$self->show_form(title => t8('Edit custom variable'),
|
|
57 |
$self->show_form(title => t8('Edit taxzone'),
|
|
58 | 58 |
CHARTLIST => SL::DB::TaxzoneChart->get_all_accounts_by_taxzone_id($self->config->id)); |
59 | 59 |
} |
60 | 60 |
|
... | ... | |
115 | 115 |
} |
116 | 116 |
|
117 | 117 |
$self->config->save; |
118 |
$self->config->obsolete($::form->{"obsolete"}); |
|
118 | 119 |
|
119 | 120 |
#Save taxzone_charts for new taxzones: |
120 | 121 |
if ($is_new) { |
SL/DB/MetaSetup/TaxZone.pm | ||
---|---|---|
11 | 11 |
__PACKAGE__->meta->columns( |
12 | 12 |
description => { type => 'text' }, |
13 | 13 |
id => { type => 'integer', not_null => 1, sequence => 'id' }, |
14 |
obsolete => { type => 'boolean', default => 'false' }, |
|
14 | 15 |
sortkey => { type => 'integer', not_null => 1 }, |
15 | 16 |
); |
16 | 17 |
|
SL/Form.pm | ||
---|---|---|
2145 | 2145 |
my ($self, $dbh, $key) = @_; |
2146 | 2146 |
|
2147 | 2147 |
$key = "all_taxzones" unless ($key); |
2148 |
my $tzfilter = ""; |
|
2149 |
$tzfilter = "WHERE obsolete is FALSE" if $key eq 'ALL_ACTIVE_TAXZONES'; |
|
2148 | 2150 |
|
2149 |
my $query = qq|SELECT * FROM tax_zones ORDER BY sortkey|; |
|
2151 |
my $query = qq|SELECT * FROM tax_zones $tzfilter ORDER BY sortkey|;
|
|
2150 | 2152 |
|
2151 | 2153 |
$self->{$key} = selectall_hashref_query($self, $dbh, $query); |
2152 | 2154 |
|
bin/mozilla/is.pl | ||
---|---|---|
305 | 305 |
|
306 | 306 |
$form->{defaultcurrency} = $form->get_default_currency(\%myconfig); |
307 | 307 |
|
308 |
$form->get_lists("taxzones" => "ALL_TAXZONES",
|
|
308 |
$form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"),
|
|
309 | 309 |
"currencies" => "ALL_CURRENCIES", |
310 | 310 |
"customers" => "ALL_CUSTOMERS", |
311 | 311 |
"departments" => "all_departments", |
bin/mozilla/oe.pl | ||
---|---|---|
350 | 350 |
|
351 | 351 |
my $vc = $form->{vc} eq "customer" ? "customers" : "vendors"; |
352 | 352 |
|
353 |
# project ids |
|
354 |
$form->get_lists("taxzones" => "ALL_TAXZONES", |
|
353 |
$form->get_lists("taxzones" => ($form->{id} ? "ALL_TAXZONES" : "ALL_ACTIVE_TAXZONES"), |
|
355 | 354 |
"payments" => "ALL_PAYMENTS", |
356 | 355 |
"currencies" => "ALL_CURRENCIES", |
357 | 356 |
"departments" => "ALL_DEPARTMENTS", |
sql/Pg-upgrade2/tax_zones_obsolete.sql | ||
---|---|---|
1 |
-- @tag: tax_zones_obsolete |
|
2 |
-- @description: Steuerzonen auf ungültig setzen können |
|
3 |
-- @depends: change_taxzone_id_0 |
|
4 |
ALTER TABLE tax_zones ADD COLUMN obsolete boolean DEFAULT FALSE; |
templates/webpages/buchungsgruppen/form.html | ||
---|---|---|
10 | 10 |
</tr> |
11 | 11 |
<tr> |
12 | 12 |
<th align="right">[% 'Inventory account' | $T8 %]</th> |
13 |
[%- IF SELF.config.id %] |
|
13 |
[%- IF SELF.config.id AND linked_parts != 0 %]
|
|
14 | 14 |
<td>[%- CHARTLIST.inventory_accno %] -- [%- CHARTLIST.inventory_accno_description %]</td> |
15 | 15 |
[%- ELSE %] |
16 | 16 |
<td>[%- L.select_tag("config.inventory_accno_id", ACCOUNTS.ic, title_sub=\account_label, default=SELF.config.inventory_accno_id) %]</td> |
... | ... | |
19 | 19 |
[%- FOREACH tz = TAXZONES %] |
20 | 20 |
<tr> |
21 | 21 |
<th align="right">[% 'Revenue' | $T8 %] [% HTML.escape(tz.description) %]</th> |
22 |
[%- IF SELF.config.id %] |
|
22 |
[%- IF SELF.config.id AND linked_parts != 0 %]
|
|
23 | 23 |
<td>[% CHARTLIST.${tz.id}.income_accno %] -- [% CHARTLIST.${tz.id}.income_accno_description %]</td> |
24 | 24 |
[%- ELSE %] |
25 | 25 |
<td>[%- L.select_tag('income_accno_id_' _ tz.id, ACCOUNTS.ic_income, title_sub=\account_label, default=CHARTLIST.${tz.id}.income_accno_id) %]</td> |
... | ... | |
27 | 27 |
</tr> |
28 | 28 |
<tr> |
29 | 29 |
<th align="right">[% 'Expense' | $T8 %] [% HTML.escape(tz.description) %]</th> |
30 |
[%- IF SELF.config.id %] |
|
30 |
[%- IF SELF.config.id AND linked_parts != 0 %]
|
|
31 | 31 |
<td>[% CHARTLIST.${tz.id}.expense_accno %] -- [% CHARTLIST.${tz.id}.expense_accno_description %]</td> |
32 | 32 |
[%- ELSE %] |
33 | 33 |
<td>[%- L.select_tag('expense_accno_id_' _ tz.id, ACCOUNTS.ic_expense, title_sub=\account_label, default=CHARTLIST.${tz.id}.expense_accno_id) %]</td> |
templates/webpages/is/form_header.html | ||
---|---|---|
113 | 113 |
<tr> |
114 | 114 |
<th align="right">[% 'Steuersatz' | $T8 %]</th> |
115 | 115 |
<td> |
116 |
[% L.select_tag('taxzone_id', ALL_TAXZONES, default = taxzone_id, title_key = 'description', disabled = (id ? 1 : 0), style='width: 250px', onchange = "document.getElementById('update_button').click();") %]
|
|
116 |
[% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES) , default = taxzone_id, title_key = 'description', disabled = (id ? 1 : 0), style='width: 250px', onchange = "document.getElementById('update_button').click();") %]
|
|
117 | 117 |
[%- IF id %] |
118 | 118 |
<input type='hidden' name='taxzone_id' value='[% taxzone_id %]'> |
119 | 119 |
[%- END %] |
templates/webpages/oe/form_header.html | ||
---|---|---|
108 | 108 |
<tr> |
109 | 109 |
<th align="right">[% 'Steuersatz' | $T8 %]</th> |
110 | 110 |
<td> |
111 |
[% L.select_tag('taxzone_id', ALL_TAXZONES, default=taxzone_id, title_key='description', style='width: 250px') %]
|
|
111 |
[% L.select_tag('taxzone_id', ( id ? ALL_TAXZONES : ALL_ACTIVE_TAXZONES), default=taxzone_id, title_key='description', style='width: 250px') %]
|
|
112 | 112 |
</td> |
113 | 113 |
</tr> |
114 | 114 |
[%- IF ALL_DEPARTMENTS %] |
templates/webpages/taxzones/form.html | ||
---|---|---|
28 | 28 |
[%- END %] |
29 | 29 |
</table> |
30 | 30 |
|
31 |
[% LxERP.t8('Obsolete') %]: [% L.checkbox_tag('config.obsolete', checked = SELF.config.obsolete, for_submit=1) %] |
|
32 |
|
|
31 | 33 |
<p> |
32 | 34 |
[% L.hidden_tag("action", "Taxzones/dispatch") %] |
33 | 35 |
[% L.submit_tag("action_" _ (SELF.config.id ? "update" : "create"), LxERP.t8('Save'), onclick="return check_prerequisites();") %] |
Auch abrufbar als: Unified diff
Steuerzonen ungültig machen
jede Steuerzone kann man unter "System->Steuerzonen->auf Steuerzone klicken"
individuell auf ungültig (obsolete) setzen.
ungültig heißt:
Belegen (Angebot-Rechnung)
Bei alten Belegen, die erneut geöffnet werden, ist leider das Verhalten unterschiedlich:
disabled und es wird nur die ausgewählte Steuerzone angezeigt -> funktioniert
angezeigt werden, da man die Steuerzone auch im Nachhinein ändern kann, aber
auch alle alten Belege mit mittlerweile ungültigen Steuerzonen korrekt
angezeigt werden müssen. Man kann also nicht einfach nach id fragen und
entsprechend nach ungültig filtern.
Bucht man also einen Auftrag mit einer bestimmten Steuerzone, setzt die
Steuerzone auf ungültig, und generiert dann aus dem Auftrag z.B. eine Rechnung,
würde die Steuerzone aus dem Auftrag nicht übernommen werden, sondern die erste
Steuerzone aus der Liste standardmäßig ausgewählt sein.