X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=3b47b8eac169c7d1de7c3e6d6c132309ad62abae;hb=86f876b61346bf14a4369b2739fc48ac8a7e02be;hp=38eedb0c259cd50630bf510ddf9f29a70eaaf248;hpb=8cef58b276ce4005c0e2ada350fecd5d7a103e89;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 38eedb0c2..3b47b8eac 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -35,12 +35,16 @@ use SL::AM; use SL::CA; use SL::Form; use SL::User; +use SL::USTVA; +use SL::Iconv; +use CGI::Ajax; +use CGI; use Data::Dumper; 1; -require "$form->{path}/common.pl"; +require "bin/mozilla/common.pl"; # end of main @@ -58,7 +62,7 @@ sub add_account { AM->get_account(\%myconfig, \%$form); $form->{callback} = - "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}" + "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}" unless $form->{callback}; &account_header; @@ -86,134 +90,108 @@ sub edit_account { sub account_header { $lxdebug->enter_sub(); + if ( $form->{action} eq 'edit_account') { + $form->{account_exists} = '1'; + } + $form->{title} = $locale->text("$form->{title} Account"); - $checked{ $form->{charttype} } = "checked"; - $checked{"$form->{category}_"} = "checked"; - $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked"; + $form->{"$form->{charttype}_checked"} = "checked"; + $form->{"$form->{category}_checked"} = "checked"; - $form->{description} =~ s/\"/"/g; + $form->{select_tax} = ""; + + my @tax_report_pos = USTVA->report_variables({ + myconfig => \%myconfig, + form => $form, + type => '', + attribute => 'position', + calc => '', + }); if (@{ $form->{TAXKEY} }) { foreach my $item (@{ $form->{TAXKEY} }) { - $item->{rate} = $item->{rate} * 100 . '%'; + } - if ($item->{tax} == $form->{tax}) { - $form->{selecttaxkey} .= - "{tax} selected>$item->{taxdescription} ($item->{rate})\n"; - } else { - $form->{selecttaxkey} .= - "{tax}>$item->{taxdescription} ($item->{rate})\n"; - } + # Fill in empty row for new Taxkey + $newtaxkey_ref = { + id => '', + chart_id => '', + accno => '', + tax_id => '', + taxdescription => '', + rate => '', + taxkey_id => '', + pos_ustva => '', + startdate => '', + }; + + push @{ $form->{ACCOUNT_TAXKEYS} }, $newtaxkey_ref; + + my $i = 0; + foreach my $taxkey_used (@{ $form->{ACCOUNT_TAXKEYS} } ) { + + # Fill in a runningnumber + $form->{ACCOUNT_TAXKEYS}[$i]{runningnumber} = $i; + + # Fill in the Taxkeys as select options + foreach my $item (@{ $form->{TAXKEY} }) { + if ($item->{id} == $taxkey_used->{tax_id}) { + $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .= + qq|| + . sprintf("%.2d", $item->{taxkey}) + . qq|. $item->{taxdescription} ($item->{rate}) | + . $locale->text('Tax-o-matic Account') + . qq|: $item->{chart_accno}\n|; + } + else { + $form->{ACCOUNT_TAXKEYS}[$i]{selecttaxkey} .= + qq|| + . sprintf("%.2d", $item->{taxkey}) + . qq|. $item->{taxdescription} ($item->{rate}) | + . $locale->text('Tax-o-matic Account') + . qq|: $item->{chart_accno}\n|; + } + } + + # Fill in the USTVA Numbers as select options + foreach my $item ( '', sort({ $a cmp $b } @tax_report_pos) ) { + if ($item eq ''){ + $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|-\n|; + } + elsif ( $item == $taxkey_used->{pos_ustva} ) { + $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|$item\n|; + } + else { + $form->{ACCOUNT_TAXKEYS}[$i]{select_tax} .= qq|$item\n|; + } + + } + + $i++; } } - $taxkey = qq| - - | . $locale->text('Steuersatz') . qq| - $form->{selecttaxkey} - | . $locale->text('Gültig ab') . qq| - - |; - + # Newaccount Folgekonto if (@{ $form->{NEWACCOUNT} }) { if (!$form->{new_chart_valid}) { - $form->{selectnewaccount} = ""; + $form->{selectnewaccount} = qq| |. $locale->text('None') .q||; } foreach $item (@{ $form->{NEWACCOUNT} }) { if ($item->{id} == $form->{new_chart_id}) { $form->{selectnewaccount} .= - "{id} selected>$item->{accno}--$item->{description}"; + qq|$item->{accno}--$item->{description}|; } elsif (!$form->{new_chart_valid}) { $form->{selectnewaccount} .= - "{id}>$item->{accno}--$item->{description}"; + qq|$item->{accno}--$item->{description}|; } } } - $newaccount = qq| -