Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4aa81611

Von Bernd Blessmann vor etwa 13 Jahren hinzugefügt

  • ID 4aa816112a8b9f2d2959c92cfaa2f2954bdeceb2
  • Vorgänger 1f42dfbe
  • Nachfolger e87f4016

Änderbarkeit der Zahlungen bei Debitorenbuchungen konfigurierbar

Unterschiede anzeigen:

SL/AR.pm
201 201

  
202 202
  # add paid transactions
203 203
  for my $i (1 .. $form->{paidaccounts}) {
204

  
205
    if ($form->{"acc_trans_id_$i"} && $payments_only && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
206
      next;
207
    }
208

  
204 209
    if ($form->{"paid_$i"} != 0) {
205 210
      my $project_id = conv_i($form->{"paid_project_id_$i"});
206 211

  
......
229 234
      }
230 235

  
231 236
      if ($form->{"paid_$i"} != 0) {
232
        my $project_id = conv_i($form->{"paid_project_id_$i"});
233 237
        # add payment
238
        my $project_id = conv_i($form->{"paid_project_id_$i"});
239
        my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
234 240
        $amount = $form->{"paid_$i"} * -1;
235
        $query  = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, project_id, taxkey)
236
                     VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
237
        @values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"});
241
        $query  = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, project_id, taxkey)
242
                     VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?, ?, (SELECT taxkey_id FROM chart WHERE accno = ?))|;
243
        @values = (conv_i($form->{id}), $form->{AR}{"paid_$i"}, $amount, conv_date($form->{"datepaid_$i"}), $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $project_id, $form->{AR}{"paid_$i"});
238 244
        do_query($form, $dbh, $query, @values);
239 245

  
240 246
        # exchangerate difference for payment
......
328 334
  $old_form = save_form();
329 335

  
330 336
  # Delete all entries in acc_trans from prior payments.
331
  $self->_delete_payments($form, $dbh);
337
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
338
    $self->_delete_payments($form, $dbh);
339
  }
332 340

  
333 341
  # Save the new payments the user made before cleaning up $form.
334
  my $payments_re = '^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^paid_project_id_\d+$|^AR_paid_\d+$|^paidaccounts$';
342
  my $payments_re = '^datepaid_\d+$|^gldate_\d+$|^acc_trans_id_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^paid_project_id_\d+$|^AR_paid_\d+$|^paidaccounts$';
335 343
  map { $payments{$_} = $form->{$_} } grep m/$payments_re/, keys %{ $form };
336 344

  
337 345
  # Clean up $form so that old content won't tamper the results.
......
573 581
        $j++;
574 582
        $form->{"AR_paid_$j"} = $form->{acc_trans}{$key}->[$i-1]->{accno};
575 583

  
584
        $form->{"acc_trans_id_$j"}    = $form->{acc_trans}{$key}->[$i - 1]->{acc_trans_id};
576 585
        # reverse paid
577 586
        $form->{"paid_$j"}            = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
578 587
        $form->{"datepaid_$j"}        = $form->{acc_trans}{$key}->[$i - 1]->{transdate};
588
        $form->{"gldate_$j"}          = $form->{acc_trans}{$key}->[$i - 1]->{gldate};
579 589
        $form->{"source_$j"}          = $form->{acc_trans}{$key}->[$i - 1]->{source};
580 590
        $form->{"memo_$j"}            = $form->{acc_trans}{$key}->[$i - 1]->{memo};
581 591
        $form->{"forex_$j"}           = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};

Auch abrufbar als: Unified diff