X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=6294a18973d59da69a30fdf927830f2629af9cac;hb=4e0ea59f3859c72426f669547de922816305e92d;hp=3396d93160fb46a6a8ecc3eda6c2e1bf1cf756bb;hpb=40782548cf82ac1e4c0fe417113a4cb3072e9390;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 3396d9316..6294a1897 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| -