Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision b56c0cd7

Von Bernd Blessmann vor mehr als 13 Jahren hinzugefügt

  • ID b56c0cd76508a8d39e080f316285db1c52c17255
  • Vorgänger 80913703
  • Nachfolger c79db65d

Änderbarkeit bei Zahlungen f. Einkaufsrechnungen konfigurierbar.

Nie, immer oder am selben Tag, einstellbar in der lx_office.conf

Unterschiede anzeigen:

SL/IR.pm
499 499

  
500 500
  # record payments and offsetting AP
501 501
  for my $i (1 .. $form->{paidaccounts}) {
502
    if ($form->{"acc_trans_id_$i"}
503
        && $payments_only
504
        && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
505
      next;
506
    }
507

  
502 508
    next if $form->{"paid_$i"} == 0;
503 509

  
504 510
    my ($accno)            = split /--/, $form->{"AP_paid_$i"};
......
518 524
    }
519 525

  
520 526
    # record payment
521
    $query = qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, taxkey, project_id)
522
                VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?,
527
    my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
528

  
529
    $query =
530
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id)
531
                VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?,
523 532
                (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
524 533
    @values = (conv_i($form->{id}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
525
               $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
534
               $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
526 535
    do_query($form, $dbh, $query, @values);
527 536

  
528 537
    $exchangerate = 0;
......
1394 1403
  $old_form = save_form();
1395 1404

  
1396 1405
  # Delete all entries in acc_trans from prior payments.
1397
  $self->_delete_payments($form, $dbh);
1406
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
1407
    $self->_delete_payments($form, $dbh);
1408
  }
1398 1409

  
1399 1410
  # Save the new payments the user made before cleaning up $form.
1400
  map { $payments{$_} = $form->{$_} } grep m/^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^AP_paid_\d+$|^paidaccounts$/, keys %{ $form };
1411
  map { $payments{$_} = $form->{$_} } grep m/^datepaid_\d+$|^gldate_\d+$|^acc_trans_id_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^AP_paid_\d+$|^paidaccounts$/, keys %{ $form };
1401 1412

  
1402 1413
  # Clean up $form so that old content won't tamper the results.
1403 1414
  %keep_vars = map { $_, 1 } qw(login password id);
bin/mozilla/ir.pl
181 181
        $form->{"AP_paid_$i"} =
182 182
          "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
183 183

  
184
        $form->{"acc_trans_id_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{acc_trans_id};
184 185
        # reverse paid
185 186
        $form->{"paid_$i"}     = $form->{acc_trans}{$key}->[$i - 1]->{amount};
186 187
        $form->{"datepaid_$i"} =
187 188
          $form->{acc_trans}{$key}->[$i - 1]->{transdate};
189
        $form->{"gldate_$i"}   = $form->{acc_trans}{$key}->[$i - 1]->{gldate};
188 190
        $form->{"forex_$i"} = $form->{"exchangerate_$i"} =
189 191
          $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
190 192
        $form->{"source_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{source};
......
403 405
  my $accno_arap = IS->get_standard_accno_current_assets(\%myconfig, \%$form);
404 406

  
405 407
  for my $i (1 .. $form->{paidaccounts}) {
408
    $form->{"changeable_$i"} = 1;
409
    if ($::lx_office_conf{features}->{payments_changeable} == 0) {
410
      # never
411
      $form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
412
    } elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
413
      # on the same day
414
      $form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') || 
415
                                  ($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
416
    }
417

  
406 418
    $form->{"selectAP_paid_$i"} = $form->{selectAP_paid};
407 419
    if (!$form->{"AP_paid_$i"}) {
408 420
      $form->{"selectAP_paid_$i"} =~ s/option>$accno_arap--(.*?)>/option selected>$accno_arap--$1>/;
......
560 572

  
561 573
  # Payments must not be recorded for the new storno invoice.
562 574
  $form->{paidaccounts} = 0;
563
  map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
575
  map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ gldate_ acc_trans_id_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
564 576

  
565 577
  # saving the history
566 578
  if(!exists $form->{addition} && $form->{id} ne "") {
......
589 601

  
590 602
  $main::auth->assert('vendor_invoice_edit');
591 603

  
592
  map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
604
  map { delete $form->{$_} } qw(printed emailed queued invnumber invdate deliverydate id datepaid_1 gldate_1 acc_trans_id_1 source_1 memo_1 paid_1 exchangerate_1 AP_paid_1 storno);
593 605
  $form->{paidaccounts} = 1;
594 606
  $form->{rowcount}--;
595 607
  $form->{invdate} = $form->current_date(\%myconfig);
templates/webpages/ir/_payments.html
25 25

  
26 26

  
27 27
[% FOREACH i = paid_indices %]
28
  [% SET changeable    = 'changeable_'    _ i %]
29
  [% SET acc_trans_id  = 'acc_trans_id_'  _ i %]
30
  [% SET gldate        = 'gldate_'        _ i %]
28 31
  [% SET datepaid      = 'datepaid_'      _ i %]
29 32
  [% SET source        = 'source_'        _ i %]
30 33
  [% SET memo          = 'memo_'          _ i %]
31 34
  [% SET paid          = 'paid_'          _ i %]
35
  [% SET AP_paid       = 'AP_paid_'       _ i %]
32 36
  [% SET selectAP_paid_ref = 'selectAP_paid_' _ i %]
33 37

  
38
     <input type=hidden name="acc_trans_id_[% i %]" value=[% $acc_trans_id %]>
39
     <input type=hidden name="gldate_[% i %]" value=[% $gldate %]>
40

  
34 41
     <tr>
35 42

  
36 43
    <td align="center">
44
    [% IF $changeable %]
37 45
      <input id="datepaid_[% i %]" name="datepaid_[% i %]" size="11" title="[% dateformat %]" value="[% $datepaid %]">
38 46
      <input type="button" name="datepaid_[% i %]" id="trigger_datepaid_[% i %]" value="?">
47
    [% ELSE %]
48
      <input type="hidden" name="datepaid_[% i %]" value="[% $datepaid %]">[% $datepaid %]
49
    [% END %]
50
     </td>
51
     <td align=center>
52
    [% IF $changeable %]
53
       <input name="source_[% i %]" size="11" value="[% $source %]">
54
    [% ELSE %]
55
       <input type="hidden" name="source_[% i %]" value="[% $source %]">[% $source %]
56
    [% END %]
57
     </td>
58
     <td align="center">
59
    [% IF $changeable %]
60
       <input name="memo_[% i %]" size="11" value="[% $memo %]">
61
    [% ELSE %]
62
       <input type="hidden" name="memo_[% i %]" value="[% $memo %]">[% $memo %]
63
    [% END %]
64
     </td>
65
     <td align="center">
66
    [% IF $changeable %]
67
       <input name="paid_[% i %]" size="11" value="[% LxERP.format_amount($paid, 2, 1) %]">
68
    [% ELSE %]
69
       <input type="hidden" name="paid_[% i %]" value="[% LxERP.format_amount($paid, 2, 1) %]">
70
       [% LxERP.format_amount($paid, 2, 1) %]
71
    [% END %]
39 72
     </td>
40
     <td align=center><input name="source_[% i %]" size="11" value="[% $source %]"></td>
41
     <td align="center"><input name="memo_[% i %]" size="11" value="[% $memo %]"></td>
42
     <td align="center"><input name="paid_[% i %]" size="11" value="[% LxERP.format_amount($paid, 2, 1) %]"></td>
73

  
43 74
[% IF show_exchangerate %]
44 75
     <td align="center">
45 76
  [% SET forex        = 'forex_'        _ i %]
......
48 79
        <input type="hidden" name="exchangerate_[% i %]" value="[% LxERP.format_amount($exchangerate, 2) %]">
49 80
        [% LxERP.format_amount(exchangerate, 2) %]
50 81
  [% ELSE %]
82
     [% IF $changeable %]
51 83
        <input name="exchangerate_[% i %]" size="10" value="[% LxERP.format_amount($exchangerate, 2, 1) %]">
84
     [% ELSE %]
85
        <input type="hidden" name="exchangerate_[% i %]" value="[% LxERP.format_amount($exchangerate, 2, 1) %]">
86
        [% LxERP.format_amount($exchangerate, 2, 1) %]
87
     [% END %]
52 88
  [% END %]
53 89
        <input type="hidden" name="forex_[% i %]" value="[% $forex %]">;
54 90
     </td>
55 91
[% END %]
56
     <td align="center"><select name="AP_paid_[% i %]">[% $selectAP_paid_ref %]</select></td>
92

  
93
     <td align="center">
94
     [% IF $changeable %]
95
       <select name="AP_paid_[% i %]">[% $selectAP_paid_ref %]</select>
96
     [% ELSE %]
97
       <input type="hidden" name="AP_paid_[% i %]" value="[% $AP_paid %]">[% $AP_paid %]
98
     [% END %]
99
     </td>
57 100

  
58 101
    </tr>
102
  [% IF $changeable %]
59 103
    <script type='text/javascript'>
60 104
     Calendar.setup({ inputField : "datepaid_[% i %]", ifFormat :"[% myconfig_jsc_dateformat %]", align : "TR", button : "trigger_datepaid_[% i %]" });
61 105
     $('input[name="paid_[% i %]"]').blur(function(){ check_right_number_format(this) });
62 106
     $('#datepaid_[% i %]').blur(function(){ check_right_date_format(this) });
63 107
    </script>
108
  [% END %]
64 109

  
65 110
[% END # foreach %]
66 111

  

Auch abrufbar als: Unified diff