X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=1ebd59816fdda79dd8df2138eb5b87a67a661bfe;hb=7e6bdfc6728ec15377f5b78dd1fb4eaefed84962;hp=d7373d78bf56bd4600a978dd8baa73cd273b87f4;hpb=baf92f533975d1224700a85d0b8ededd8246d09b;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index d7373d78b..1ebd59816 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -40,6 +40,8 @@ use Data::Dumper; 1; +require "$form->{path}/common.pl"; + # end of main sub add { &{"add_$form->{type}"} } @@ -92,14 +94,13 @@ sub account_header { $form->{description} =~ s/\"/"/g; if (@{ $form->{TAXKEY} }) { - $form->{selecttaxkey} = "Keine Steuer 0%\n"; foreach $item (@{ $form->{TAXKEY} }) { - if ($item->{taxkey} == $form->{taxkey_id}) { + if ($item->{tax} == $form->{tax}) { $form->{selecttaxkey} .= - "{taxkey} selected>$item->{taxdescription}\n"; + "{tax} selected>$item->{taxdescription}\n"; } else { $form->{selecttaxkey} .= - "{taxkey}>$item->{taxdescription}\n"; + "{tax}>$item->{taxdescription}\n"; } } @@ -108,8 +109,9 @@ sub account_header { $taxkey = qq| | . $locale->text('Steuersatz') . qq| - $form->{selecttaxkey} - + $form->{selecttaxkey} + | . $locale->text('Gültig ab') . qq| + |; if (@{ $form->{NEWACCOUNT} }) { @@ -1710,6 +1712,9 @@ sub add_buchungsgruppe { "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; AM->get_buchungsgruppe(\%myconfig, \%$form); + if ($eur) { + $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"}; + } &buchungsgruppe_header; &form_footer; @@ -1763,19 +1768,19 @@ sub list_buchungsgruppe { . qq||; $column_header{income_accno_1} = qq|| - . $locale->text('Erlöse EU o. UStId') + . $locale->text('Erlöse EU m. UStId') . qq||; $column_header{expense_accno_1} = qq|| - . $locale->text('Aufwand EU o. UStId') + . $locale->text('Aufwand EU m. UStId') . qq||; $column_header{income_accno_2} = qq|| - . $locale->text('Erlöse EU m. UStId') + . $locale->text('Erlöse EU o. UStId') . qq||; $column_header{expense_accno_2} = qq|| - . $locale->text('Aufwand EU m. UStId') + . $locale->text('Aufwand EU o. UStId') . qq||; $column_header{income_accno_3} = qq|| @@ -1887,50 +1892,33 @@ sub buchungsgruppe_header { # $locale->text('Buchungsgruppe hinzufügen') # $locale->text('Buchungsgruppe bearbeiten') - $form->{description} =~ s/\"/"/g; + my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {}); + my %acc_type_map = ( + "IC" => $acc_inventory, + "IC_income" => $acc_income, + "IC_sale" => $acc_income, + "IC_expense" => $acc_expense, + "IC_cogs" => $acc_expense, + ); - # build the popup menus - $form->{taxaccounts} = ""; - foreach $key (keys %{ $form->{IC_links} }) { + foreach $key (keys(%acc_type_map)) { foreach $ref (@{ $form->{IC_links}{$key} }) { - - # if this is a tax field - if ($key =~ /IC_tax/) { - if ($key =~ /$item/) { - $form->{taxaccounts} .= "$ref->{accno} "; - $form->{"IC_tax_$ref->{accno}_description"} = - "$ref->{accno}--$ref->{description}"; - - if ($form->{id}) { - if ($form->{amount}{ $ref->{accno} }) { - $form->{"IC_tax_$ref->{accno}"} = "checked"; - } - } else { - $form->{"IC_tax_$ref->{accno}"} = "checked"; - } - } - } else { - - $form->{"select$key"} .= - "{id} $ref->{selected}>$ref->{accno}--$ref->{description}\n"; - if (($key eq "IC") && ($ref->{selected} eq "selected")) { - $form->{IC_default} = $ref->{id}; - } - if ($form->{amount}{$key} eq $ref->{accno}) { - $form->{$key} = "$ref->{accno}--$ref->{description}"; - } - - } + $acc_type_map{$key}->{$ref->{"id"}} = $ref; } } - $form->{selectIC_income} = $form->{selectIC_sale}; - $form->{selectIC_expense} = $form->{selectIC_cogs}; - $form->{IC_income} = $form->{IC_sale}; - $form->{IC_expense} = $form->{IC_cogs}; + + foreach my $type (qw(IC IC_income IC_expense)) { + $form->{"select$type"} = + join("", + map({ "{id} $_->{selected}>" . + "$_->{accno}--" . H($_->{description}) . "" } + sort({ $a->{"accno"} cmp $b->{"accno"} } + values(%{$acc_type_map{$type}})))); + } if ($form->{id}) { $form->{selectIC} =~ s/selected//g; - $form->{selectIC} =~ s/ value=\$form->{inventory_accno_id}/ value=\$form->{inventory_accno_id} selected/; + $form->{selectIC} =~ s/ value=$form->{inventory_accno_id}/ value=$form->{inventory_accno_id} selected/; $form->{selectIC_income} =~ s/selected//g; $form->{selectIC_income} =~ s/ value=$form->{income_accno_id_0}/ value=$form->{income_accno_id_0} selected/; $form->{selectIC_expense} =~ s/selected//g; @@ -1946,11 +1934,11 @@ sub buchungsgruppe_header { |; } else { $linkaccounts = qq| - |; - } + {inventory_accno_id}>|; + } - $linkaccounts .= qq| + $linkaccounts .= qq| | . $locale->text('Erlöse Inland') . qq| $form->{selectIC_income} @@ -2025,7 +2013,7 @@ sub buchungsgruppe_header { | . $locale->text('Buchungsgruppe') . qq| - + $linkaccounts @@ -2267,207 +2255,6 @@ sub delete_printer { } -sub add_adr { - $lxdebug->enter_sub(); - - $form->{title} = "Add"; - - $form->{callback} = - "$form->{script}?action=add_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; - - &adr_header; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub edit_adr { - $lxdebug->enter_sub(); - - $form->{title} = "Edit"; - - AM->get_adr(\%myconfig, \%$form); - - &adr_header; - - $form->{orphaned} = 1; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub list_adr { - $lxdebug->enter_sub(); - - AM->adr(\%myconfig, \%$form); - - $form->{callback} = - "$form->{script}?action=list_adr&path=$form->{path}&login=$form->{login}&password=$form->{password}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('ADR'); - - @column_index = qw(adr_code adr_description); - - $column_header{adr_description} = - qq|| - . $locale->text('ADR Description') - . qq||; - $column_header{adr_code} = - qq|| - . $locale->text('ADR Code') - . qq||; - - $form->header; - - print qq| - - - - - $form->{title} - - - - - - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - - $column_data{adr_code} = - qq|{script}?action=edit_adr&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{adr_code}|; - $column_data{adr_description} = qq|$ref->{adr_description}|; - - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| - - - - - - - - - -{script}> - - - - - -{path}> -{login}> -{password}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| - - - - -