X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/57eb13371bb3387afbef6ffa4cb71dd9d9f9e33e..545d8542873ac7cb75ed71771a1bd384fe57bfe2:/bin/mozilla/cp.pl diff --git a/bin/mozilla/cp.pl b/bin/mozilla/cp.pl index d341ffdfc..1fa5d34c6 100644 --- a/bin/mozilla/cp.pl +++ b/bin/mozilla/cp.pl @@ -32,10 +32,8 @@ #====================================================================== use SL::CP; -use SL::OP; use SL::IS; use SL::IR; - use strict ("vars", "subs"); #use warnings; @@ -50,7 +48,6 @@ our ($form, %myconfig, $lxdebug, $locale, $auth); sub payment { $lxdebug->enter_sub(); - $auth->assert('cash'); my (@curr); @@ -74,18 +71,17 @@ sub payment { } # departments - if (@{ $form->{all_departments} }) { + if (@{ $form->{all_departments} || [] }) { $form->{selectdepartment} = "\n"; $form->{department} = "$form->{department}--$form->{department_id}"; map { $form->{selectdepartment} .= "$_->{description}--$_->{id}\n" - } (@{ $form->{all_departments} }); + } (@{ $form->{all_departments} || [] }); } CP->paymentaccounts(\%myconfig, \%$form); - $form->{selectaccount} = ""; $form->{"select$form->{ARAP}"} = ""; @@ -145,17 +141,17 @@ sub form_header { $form->format_amount(\%myconfig, $form->{exchangerate}); if ($form->{forex}) { $exchangerate = qq| - - | . $locale->text('Exchangerate') . qq| - {exchangerate}>$form->{exchangerate} - + + | . $locale->text('Exchangerate') . qq| + {exchangerate}>$form->{exchangerate} + |; } else { $exchangerate = qq| - - | . $locale->text('Exchangerate') . qq| - {exchangerate}> - + + | . $locale->text('Exchangerate') . qq| + {exchangerate}> + |; } } @@ -182,16 +178,6 @@ sub form_header { # $locale->text('AR') # $locale->text('AP') - $department = qq| - - | . $locale->text('Department') . qq| - $form->{selectdepartment} - - - - -| if $form->{selectdepartment}; - $form->{jsscript} = 1; $jsscript = ""; if ($form->{jsscript}) { @@ -245,82 +231,74 @@ sub form_header { - - - - - - - | . $locale->text('All') . qq| - - - $vclabel - $vc - {vc}"}"> - {"$form->{vc}_id"}> - {vc}"}"> - - - | . $locale->text('Address') . qq| - - - - $form->{street} - - - $form->{zipcode} - - - $form->{city} - - - $form->{country} - - - - - - - - - - | . $locale->text('Memo') . qq| - - - - - - - $department - - | . $locale->text('Account') . qq| - $form->{selectaccount} - - - - - | . $locale->text('Date') . qq| + + + + $vclabel + $vc + {vc}"}) . qq|"> + {vc}_id"}) . qq|"> + {vc}"}) . qq|"> + + + | . $locale->text('Address') . qq| + + + + $form->{street} + + + $form->{zipcode} + + + $form->{city} + + + $form->{country} + + + + + + + + + + | . $locale->text('Memo') . qq| + + + + + + + $department + + | . $locale->text('Account') . qq| + $form->{selectaccount} + + + + + | . $locale->text('Date') . qq| $button1 - - - | . $locale->text('Currency') . qq| - $form->{selectcurrency} - - {oldcurrency}> - - $exchangerate - - | . $locale->text('Source') . qq| - - - - | . $locale->text('Amount') . qq| - - - - - + + + | . $locale->text('Currency') . qq| + $form->{selectcurrency} + + + $exchangerate + + | . $locale->text('Source') . qq| + + + + | . $locale->text('Amount') . qq| + | . $form->format_amount(\%myconfig, $form->{amount}, 2) . qq| + + + + @@ -328,6 +306,19 @@ sub form_header { $jsscript |; + if ($form->{openinvoices_other_currencies}) { + my $warning = $form->{vc} eq 'customer' ? $::locale->text('There are #1 more open invoices for this customer with other currencies.', $form->{openinvoices_other_currencies}) + : $::locale->text('There are #1 more open invoices from this vendor with other currencies.', $form->{openinvoices_other_currencies}); + + print qq| + + + + | . $::locale->text('Note') . qq|: $warning + +|; + } + $lxdebug->leave_sub(); } @@ -350,9 +341,9 @@ sub list_invoices { - - $invoice - + + $invoice + |; $column_data{invnumber} = @@ -415,7 +406,7 @@ sub list_invoices { $j++; $j %= 2; print qq| - + |; map { print "$column_data{$_}\n" } @column_index; print qq| @@ -476,7 +467,7 @@ sub form_footer { $format .= qq| {DF}{postscript}>| . $locale->text('Postscript') . qq| - {DF}{pdf}>| . $locale->text('PDF'); + {DF}{pdf}>| . $locale->text('PDF'); } print qq| @@ -632,7 +623,7 @@ sub update { } # Modified by J.Zach, see abovev - $amount += $form->{"paid_$i"}; + $amount += $form->{"paid_$i"}; } else { $form->{"paid_$i"} = ""; @@ -646,7 +637,7 @@ sub update { } # Line added by J.Zach, see above - $form->{amount}=$amount; + $form->{amount}=$amount; &form_header; &list_invoices; @@ -667,6 +658,8 @@ sub post { unless $form->{exchangerate}; } + $form->{callback} = "cp.pl?action=payment&vc=$form->{vc}&muh=kuh&account=$form->{account}"; + my $msg1 = "$form->{origtitle} posted!"; my $msg2 = "Cannot post $form->{origtitle}!"; @@ -684,7 +677,7 @@ sub post { sub print { $lxdebug->enter_sub(); - + exit; # Niemand braucht mich mehr! LöschMich endlich! jb 8.10.2010 $auth->assert('cash'); my ($whole, $check, %queued, $spool, $filename, $userspath); @@ -769,11 +762,21 @@ sub check_form { if ($form->{currency} ne $form->{oldcurrency}) { &update; - exit; + ::end_of_request(); } - - $form->error($locale->text('Zero amount posting!')) if !$form->parse_amount(\%myconfig, $form->{amount}); $form->error($locale->text('Date missing!')) unless $form->{datepaid}; + my $selected_check = 1; + for my $i (1 .. $form->{rowcount}) { + if ($form->{"checked_$i"}) { + if ($form->parse_amount(\%myconfig, $form->{"paid_$i"}, 2) <= 0) { # negativen Betrag eingegeben + $form->error($locale->text('No zero or negative values, please! Correct row number:' . $i)); + } + undef($selected_check); + # last; # ich muss doch über alle buchungen laufen, da ich noch + # die freitext-eingabe der werte prüfen will + } + } + $form->error($locale->text('No transaction selected!')) if $selected_check; $closedto = $form->datetonum($form->{closedto}, \%myconfig); $datepaid = $form->datetonum($form->{datepaid}, \%myconfig);