X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Fam.pl;h=6294a18973d59da69a30fdf927830f2629af9cac;hb=4e0ea59f3859c72426f669547de922816305e92d;hp=e34957f94782ee98d4663ee0b2bd61d093593895;hpb=b12e8d1411cb7af3a1a9b6f7637692f0758b4741;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e34957f94..6294a1897 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -35,43 +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 delete { &{"delete_$form->{type}"} } - -sub display { - if ($form->{display_nextsub}) { - &{ $form->{display_nextsub} }(); - } else { - &{ $form->{nextsub} }(); - } -} - -sub save { - if ($form->{save_nextsub}) { - &{ $form->{save_nextsub} }(); - } else { - &{ $form->{nextsub} }(); - } -} - -sub edit { - if ($form->{edit_nextsub}) { - &{ $form->{edit_nextsub} }(); - } else { - &{ "edit_$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(); @@ -81,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; @@ -109,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| -
"; - - my %formname_setup = - ( - "balance_sheet" => { "translation" => $locale->text('Balance Sheet'), "html" => 1 }, - "bin_list" => $locale->text('Bin List'), - "bwa" => { "translation" => $locale->text('BWA'), "html" => 1 }, - "check" => { "translation" => $locale->text('Check'), "html" => 1 }, - "credit_note" => $locale->text('Credit Note'), - "income_statement" => { "translation" => $locale->text('Income Statement'), "html" => 1 }, - "invoice" => $locale->text('Invoice'), - "packing_list" => $locale->text('Packing List'), - "pick_list" => $locale->text('Pick List'), - "proforma" => $locale->text('Proforma Invoice'), - "purchase_order" => $locale->text('Purchase Order'), - "receipt" => { "translation" => $locale->text('Receipt'), "tex" => 1 }, - "request_quotation" => $locale->text('RFQ'), - "sales_order" => $locale->text('Confirmation'), - "sales_quotation" => $locale->text('Quotation'), - "statement" => $locale->text('Statement'), - "storno_invoice" => $locale->text('Storno Invoice'), - "storno_packing_list" => $locale->text('Storno Packing List'), - "ustva-2004" => { "translation" => $locale->text("USTVA 2004"), "tex" => 1 }, - "ustva-2005" => { "translation" => $locale->text("USTVA 2005"), "tex" => 1 }, - "ustva-2006" => { "translation" => $locale->text("USTVA 2006"), "tex" => 1 }, - "ustva-2007" => { "translation" => $locale->text("USTVA 2007"), "tex" => 1 }, - "ustva" => $locale->text("USTVA"), - "zahlungserinnerung" => $locale->text('Payment Reminder'), - ); - - my (@values, %labels, $file, $setup); - - while (($file, $setup) = each(%formname_setup)) { - next unless (!ref($setup) || $setup->{$format}); - - push(@values, $file); - $labels{$file} = ref($setup) ? $setup->{translation} : $setup; - } - @values = sort({ $labels{$a} cmp $labels{$b} } @values); - - $edit_options .= - $locale->text("Template") . " " . - NTI($cgi->popup_menu("-name" => "formname", "-default" => $form->{formname}, - "-values" => \@values, "-labels" => \%labels)); - - $form->get_lists("printers" => "ALL_PRINTERS", - "languages" => "ALL_LANGUAGES"); - - @values = (""); - %labels = (); - - foreach my $item (@{ $form->{ALL_LANGUAGES} }) { - next unless ($item->{template_code}); - my $key = "$item->{id}--$item->{template_code}"; - push(@values, $key); - $labels{$key} = $item->{description}; - } - - if (1 != scalar(@values)) { - $edit_options .= - " " . $locale->text("Language") . " " . - NTI($cgi->popup_menu("-name" => "language", "-default" => $form->{language}, - "-values" => \@values, "-labels" => \%labels)); - } - - @values = (""); - %labels = (); - - foreach my $item (@{ $form->{ALL_PRINTERS} }) { - next unless ($item->{template_code}); - my $key = "$item->{id}--$item->{template_code}"; - push(@values, $key); - $labels{$key} = $item->{printer_description}; - } - - if (1 != scalar(@values)) { - $edit_options .= - " " . $locale->text("Printer") . " " . - NTI($cgi->popup_menu("-name" => "printer", "-default" => $form->{printer}, - "-values" => \@values, "-labels" => \%labels)); - } - - $edit_options .= qq| - - - - - -
| - . NTI($cgi->textarea("-name" => "content", - "-id" => "content", - "-default" => $content, - "-columns" => 100, - "-rows" => 25)) - . qq|
- - - -
-
| . H($content) . qq|