X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fcp.pl;h=888bf8a9f5669de2fdec483f375780eeb5c071d7;hb=4bd1e2f8b588972f10f92728301feacefd5ee4dd;hp=94e0748dcb75278889dd8f8f30b8f5b1bf35cb08;hpb=2165adf654de309f8308eb7ab5363d1337c2754e;p=kivitendo-erp.git diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index 94e0748dc..888bf8a9f 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -32,11 +32,12 @@ #====================================================================== use SL::CP; -use SL::OP; use SL::IS; use SL::IR; - -use strict ("vars", "subs"); +use SL::AR; +use SL::AP; +use Data::Dumper; +use strict; #use warnings; require "bin/mozilla/arap.pl"; @@ -60,52 +61,63 @@ sub payment { # setup customer/vendor selection for open invoices if ($form->{all_vc}) { + # Dieser Zweig funktioniert derzeit NIE. Ggf. ganz raus oder + # alle offenen Zahlungen wieder korrekt anzeigen. jb 12.10.2010 $form->all_vc(\%myconfig, $form->{vc}, $form->{ARAP}); } else { CP->get_openvc(\%myconfig, \%$form); } - + # Auswahlliste für vc zusammenbauen + # Erweiterung für schliessende option und erweiterung um value + # für bugfix 1771 (doppelte Leerzeichen werden nicht 'gepostet') $form->{"select$form->{vc}"} = ""; if ($form->{"all_$form->{vc}"}) { + $form->{"select$form->{vc}"} .= "\n"; + # s.o. jb 12.10.2010 $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id}; - map { $form->{"select$form->{vc}"} .= "\n" } @{ $form->{"all_$form->{vc}"} }; } - - # departments - if (@{ $form->{all_departments} }) { - $form->{selectdepartment} = "\n"; + $form->{account} = "$_->{accno}--$_->{description}" if ($_->{accno} eq $accno_arap) } @{ $form->{PR}{"$form->{ARAP}_paid"} }; + + # Braucht man das hier überhaupt? Erstmal auskommentieren .. jan 18.12.2010 + # map { + # $form->{"select$form->{ARAP}"} .= + # "\n" } @curr; - $form->{media} = "screen"; &form_header; &form_footer; @@ -114,56 +126,31 @@ sub payment { } sub form_header { - $lxdebug->enter_sub(); + $lxdebug->enter_sub; $auth->assert('cash'); - my ($vc, $vclabel, $allvc, $arap, $department, $exchangerate); - my ($jsscript, $button1, $button2, $onload); - - $vclabel = ucfirst $form->{vc}; - $vclabel = $locale->text($vclabel); - - if ($form->{type} eq 'receipt') { - $form->{title} = $locale->text('Receipt'); - $form->{origtitle} = "Receipt"; - } - if ($form->{type} eq 'check') { - $form->{title} = $locale->text('Payment'); - $form->{origtitle} = "Payment"; - } - - # $locale->text('Customer') - # $locale->text('Vendor') + my ($vc, $arap, $exchangerate); if ($form->{ $form->{vc} } eq "") { map { $form->{"addr$_"} = "" } (1 .. 4); } - if ($form->{currency} ne $form->{defaultcurrency}) { - $form->{exchangerate} = - $form->format_amount(\%myconfig, $form->{exchangerate}); - if ($form->{forex}) { - $exchangerate = qq| - - | . $locale->text('Exchangerate') . qq| - {exchangerate}>$form->{exchangerate} - -|; - } else { - $exchangerate = qq| - - | . $locale->text('Exchangerate') . qq| - {exchangerate}> - -|; - } + # sometimes it happens that values in customer arrive without the signs '--' + # but in order to select the right option field we need values with '--' + if ($form->{vc} eq "customer" && $form->{"all_$form->{vc}"}){ + my ($customername) = split /--/, $form->{ $form->{vc} }; + $form->{ $form->{vc} } = $customername . "--" . $form->{customer_id}; } - - foreach my $item ($form->{vc}, "account", "currency", $form->{ARAP}, "department") { + # bugfix 1771 + # geändert von + # offen: $form->{ARAP} kann raus? + for my $item ($form->{vc}, "account", "currency", $form->{ARAP}) { + $form->{$item} = H($form->{$item}); $form->{"select$item"} =~ s/ selected//; - $form->{"select$item"} =~ - s/option>\Q$form->{$item}\E/option selected>$form->{$item}/; + $form->{"select$item"} =~ s/option value="\Q$form->{$item}\E">\Q$form->{$item}\E/option selected value="$form->{$item}">$form->{$item}/; } $vc = @@ -171,334 +158,51 @@ sub form_header { ? qq|| : qq|{vc} size=35 value="$form->{$form->{vc}}">|; - if ($form->{all_vc}) { - $allvc = "checked"; - $form->{openinvoices} = ""; - } else { - $allvc = ""; - $form->{openinvoices} = 1; - } + $form->{openinvoices} = $form->{all_vc} ? "" : 1; # $locale->text('AR') # $locale->text('AP') - $form->{jsscript} = 1; - $jsscript = ""; - if ($form->{jsscript}) { - - # with JavaScript Calendar - $button1 = qq| - - text('button') . qq|> - |; - - #write Trigger - $jsscript = - Form->write_trigger(\%myconfig, "1", "datepaid", "BL", "trigger1"); - } else { - - # without JavaScript Calendar - $button1 = qq| - |; - } - $form->{javascript} .= qq||; $form->header; $arap = lc $form->{ARAP}; - $onload = qq|focus()|; - $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|; - $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|; - print qq| - - -
- -{defaultcurrency}> -{closedto}> -{vc}> -{type}> -{type}> - - -{ARAP}> -{openinvoices}> - - - - - - - - - - - - -$jsscript -|; - $lxdebug->leave_sub(); + print $::form->parse_html_template('cp/form_header', { + is_customer => $form->{vc} eq 'customer', + is_receipt => $form->{type} eq 'receipt', + arap => $arap, + vccontent => $vc, + }); + + $lxdebug->leave_sub; } sub list_invoices { - $lxdebug->enter_sub(); - - $auth->assert('cash'); - - my (@column_index, %column_data, $colspan, $invoice); - my ($totalamount, $totaldue, $totalpaid); - - @column_index = qw(invnumber transdate amount due checked paid); - - $colspan = $#column_index + 1; - - $invoice = $locale->text('Invoices'); - - print qq| - - - - -|; + print $::form->parse_html_template('cp/invoices', { + invoices => \@invoices, + totals => \%total, + }); - $lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub form_footer { - $lxdebug->enter_sub(); - - $auth->assert('cash'); - - my ($media, $format, $latex_templates); + $::lxdebug->enter_sub; + $::auth->assert('cash'); - $form->{DF}{ $form->{format} } = "selected"; - $form->{OP}{ $form->{media} } = "selected"; + print $::form->parse_html_template('cp/form_footer'); - $media = qq| - - - -
$form->{title}
- - - - - -
- - - - - - - - - {vc}"}"> - {"$form->{vc}_id"}> - {vc}"}"> - - - - - - - - - - - - - -
- - | . $locale->text('All') . qq|
$vclabel$vc
| . $locale->text('Address') . qq| - - - - - - - - - - - - - -
$form->{street}
$form->{zipcode}
$form->{city}
$form->{country}
-
| . $locale->text('Memo') . qq|
-
- - $department - - - - - - - $button1 - - - - - - {oldcurrency}> - - $exchangerate - - - - - - - - -
| . $locale->text('Account') . qq| - -
| . $locale->text('Date') . qq|
| . $locale->text('Currency') . qq|
| . $locale->text('Source') . qq|
| . $locale->text('Amount') . qq|
-
-
- - - - -|; - - $column_data{invnumber} = - qq|"; - $column_data{transdate} = - qq|"; - $column_data{amount} = - qq|"; - $column_data{due} = - qq|"; - $column_data{paid} = - qq|"; - $column_data{checked} = - qq|"; - - print qq| - -|; - map { print "$column_data{$_}\n" } @column_index; - print qq| - -|; - - for my $i (1 .. $form->{rowcount}) { - - my $j = 0; - - map { - $form->{"${_}_$i"} = - $form->parse_amount(\%myconfig, $form->{"${_}_$i"}) - } qw(amount due paid); - - $totalamount += $form->{"amount_$i"}; - $totaldue += $form->{"due_$i"}; - $totalpaid += $form->{"paid_$i"}; - - map { - $form->{"${_}_$i"} = - $form->format_amount(\%myconfig, $form->{"${_}_$i"}, 2) - } qw(amount due paid); - - $column_data{invnumber} = qq| - - {"id_$i"}>|; - $column_data{transdate} = qq| - {"transdate_$i"}>|; - $column_data{amount} = - qq| - {"amount_$i"}>|; - $column_data{due} = qq| - {"due_$i"}>|; - - $column_data{paid} = - qq||; - - $form->{"checked_$i"} = ($form->{"checked_$i"}) ? "checked" : ""; - $column_data{checked} = - qq||; - - $j++; - $j %= 2; - print qq| - -|; - map { print "$column_data{$_}\n" } @column_index; - print qq| - -|; + $::lxdebug->enter_sub; + $::auth->assert('cash'); + + my @columns = qw(amount due paid invnumber id transdate checked); + my (@invoices, %total); + for my $i (1 .. $::form->{rowcount}) { + push @invoices, +{ map { $_ => $::form->{"$_\_$i"} } @columns }; + $total{$_} += $invoices[-1]{$_} = $::form->parse_amount(\%::myconfig, $invoices[-1]{$_}) for qw(amount due paid); } - map { $column_data{$_} = "" } @column_index; - - $column_data{amount} = - qq||; - $column_data{due} = - qq||; - $column_data{paid} = - qq||; - - print qq| - -|; - map { print "$column_data{$_}\n" } @column_index; - print qq| - -
$invoice
| . $locale->text('Invoice') . "| . $locale->text('Date') . "| . $locale->text('Amount') . "| . $locale->text('Due') . "| . $locale->text('Amount') . "| . $locale->text('Select') . "
$form->{"invnumber_$i"}$form->{"transdate_$i"}$form->{"amount_$i"}$form->{"due_$i"}{"paid_$i"}>{"checked_$i"}>
 | - . $form->format_amount(\%myconfig, $totalamount, 2, " ") - . qq|| - . $form->format_amount(\%myconfig, $totaldue, 2, " ") - . qq|| - . $form->format_amount(\%myconfig, $totalpaid, 2, " ") - . qq|
-

-{rowcount}> - -
- -|; - - if ($latex_templates) { - print qq| -|; - } - - print qq| - - - -
- - - -|; - - $lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub update { @@ -517,6 +221,7 @@ sub update { } # if we switched to all_vc + # funktioniert derzeit nicht 12.10.2010 jb if ($form->{all_vc} ne $form->{oldall_vc}) { $form->{openinvoices} = ($form->{all_vc}) ? 0 : 1; @@ -532,7 +237,7 @@ sub update { "