]> wagnertech.de Git - mfinanz.git/blobdiff - bin/mozilla/is.pl
booking roundings to new standard-accounts
[mfinanz.git] / bin / mozilla / is.pl
index 7700fc2710b2701084fae5f8297fe15db88285be..bbbd157a3135cf2ad601c601ed8b7bc28f99180f 100644 (file)
@@ -292,7 +292,10 @@ sub form_header {
   my %TMPL_VAR = ();
   my @custom_hiddens;
 
-  $TMPL_VAR{invoice_obj} = SL::DB::Invoice->new(id => $form->{id})->load if $form->{id};
+  if ($form->{id}) {
+    require SL::DB::Invoice;
+    $TMPL_VAR{invoice_obj} = SL::DB::Invoice->new(id => $form->{id})->load;
+  }
   $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id};
   $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id};
 
@@ -460,6 +463,10 @@ sub form_footer {
     }
   }
 
+  my $total = $form->round_amount( $form->{invtotal}, 2, 1 );
+  $form->{rounding} = $form->round_amount( $total-$form->{invtotal}, 2 );
+  $form->{invtotal} = $total;
+
   # follow ups
   if ($form->{id}) {
     $form->{follow_ups}            = FU->follow_ups('trans_id' => $form->{id}) || [];
@@ -679,6 +686,7 @@ sub post_payment {
 
   $main::auth->assert('invoice_edit');
 
+  $form->mtime_ischanged('ar') ;
   my $invdate = $form->datetonum($form->{invdate}, \%myconfig);
 
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
@@ -734,6 +742,7 @@ sub post {
   my $locale   = $main::locale;
 
   $main::auth->assert('invoice_edit');
+  $form->mtime_ischanged('ar');
 
   $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
   $form->isblank("invdate",  $locale->text('Invoice Date missing!'));