]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/cp.pl
Neu-Aufbau Lx-Office Bildschirm
[mfinanz.git] / bin / mozilla / cp.pl
index 94f82e694fe8d33fec3502ed2242f52050939a8f..1fa5d34c6fa34c4431c74ab0e4de132a632b19cf 100644 (file)
 #======================================================================
 
 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);
@@ -85,7 +82,6 @@ sub payment {
   }
 
   CP->paymentaccounts(\%myconfig, \%$form);
-
   $form->{selectaccount} = "";
   $form->{"select$form->{ARAP}"} = "";
 
@@ -237,12 +233,6 @@ sub form_header {
         <tr valign=top>
           <td>
             <table>
-              <tr>
-                <td align=right>
-                <input name=all_vc type=checkbox style=checkbox value=Y $allvc>
-                <input type=hidden name="oldall_vc" value="$form->{all_vc}"></td>
-                <th align=left>| . $locale->text('All') . qq|</th>
-              </tr>
               <tr>
                 <th align=right>$vclabel</th>
                 <td>$vc</td>
@@ -296,7 +286,6 @@ sub form_header {
                 <th align=right nowrap>| . $locale->text('Currency') . qq|</th>
                 <td><select name=currency>$form->{selectcurrency}</select></td>
                 <input type=hidden name=selectcurrency value="$form->{selectcurrency}">
-                <input type=hidden name=oldcurrency value=$form->{oldcurrency}>
               </tr>
               $exchangerate
               <tr>
@@ -305,8 +294,7 @@ sub form_header {
               </tr>
               <tr>
                 <th align="right" nowrap>| . $locale->text('Amount') . qq|</th>
-                <td colspan="3"><input name="amount" size="10" value="|
-    . $form->format_amount(\%myconfig, $form->{amount}, 2) . qq|" onBlur=\"check_right_number_format(this)\"></td>
+                <td colspan="3">| .  $form->format_amount(\%myconfig, $form->{amount}, 2) . qq|</td>
               </tr>
             </table>
           </td>
@@ -318,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|
+
+  <input type="hidden" name="openinvoices_other_currencies" value="| . H($form->{openinvoices_other_currencies}) . qq|">
+  <tr>
+   <td><b>| . $::locale->text('Note') . qq|: $warning</b></td>
+  </tr>
+|;
+  }
+
   $lxdebug->leave_sub();
 }
 
@@ -657,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}!";
 
@@ -674,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);
@@ -759,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);