X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=77d8878ffdb1e7390b41a6e548830a8468eabded;hb=991315859c7b0f25da49baad4822492510b6b3bb;hp=fcaf0b2a5691949519f8ef9991e45f69405b968b;hpb=e07e9534d0c611913e31bc620c65e46701e5f000;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index fcaf0b2a5..77d8878ff 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -35,21 +35,24 @@ 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 -sub add { &{"add_$form->{type}"} } -sub edit { &{"edit_$form->{type}"} } -sub save { &{"save_$form->{type}"} } -sub delete { &{"delete_$form->{type}"} } +sub add { call_sub("add_$form->{type}"); } +sub delete { call_sub("delete_$form->{type}"); } +sub save { call_sub("save_$form->{type}"); } +sub edit { call_sub("edit_$form->{type}"); } +sub continue { call_sub($form->{"nextsub"}); } sub add_account { $lxdebug->enter_sub(); @@ -59,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; @@ -87,131 +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 $item (@{ $form->{TAXKEY} }) { - if ($item->{tax} == $form->{tax}) { - $form->{selecttaxkey} .= - "{tax} selected>$item->{taxdescription}\n"; - } else { - $form->{selecttaxkey} .= - "{tax}>$item->{taxdescription}\n"; - } + foreach my $item (@{ $form->{TAXKEY} }) { + $item->{rate} = $item->{rate} * 100 . '%'; + } + # 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| -
\n$form->{body}\n