Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision f45b296f

Von Bernd Blessmann vor etwa 13 Jahren hinzugefügt

  • ID f45b296fb0bb9491d86d80e9f7a7d79c3e0295ba
  • Vorgänger 7274f9c8
  • Nachfolger 80913703

Änderbarkeit bei Zahlungen f. Verkaufsrechnungen konfigurierbar.

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

Unterschiede anzeigen:

SL/IS.pm
877 877
  # record payments and offsetting AR
878 878
  if (!$form->{storno}) {
879 879
    for my $i (1 .. $form->{paidaccounts}) {
880
      
881
      if ($form->{"acc_trans_id_$i"}
882
          && $payments_only
883
          && ($::lx_office_conf{features}->{payments_changeable} == 0)) {
884
        next;
885
      }
880 886

  
881 887
      next if ($form->{"paid_$i"} == 0);
882 888

  
......
908 914

  
909 915
      # record payment
910 916
      $form->{"paid_$i"} *= -1;
917
      my $gldate = (conv_date($form->{"gldate_$i"}))? conv_date($form->{"gldate_$i"}) : conv_date($form->current_date($myconfig));
911 918

  
912 919
      $query =
913
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, source, memo, taxkey, project_id)
914
         VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?,
920
      qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate, source, memo, taxkey, project_id)
921
         VALUES (?, (SELECT id FROM chart WHERE accno = ?), ?, ?, ?, ?, ?,
915 922
                 (SELECT taxkey_id FROM chart WHERE accno = ?), ?)|;
916 923
      @values = (conv_i($form->{"id"}), $accno, $form->{"paid_$i"}, $form->{"datepaid_$i"},
917
                 $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
924
                 $gldate, $form->{"source_$i"}, $form->{"memo_$i"}, $accno, $project_id);
918 925
      do_query($form, $dbh, $query, @values);
919 926

  
920 927
      # exchangerate difference
......
1128 1135
  $old_form = save_form();
1129 1136

  
1130 1137
  # Delete all entries in acc_trans from prior payments.
1131
  $self->_delete_payments($form, $dbh);
1138
  if ($::lx_office_conf{features}->{payments_changeable} != 0) {
1139
    $self->_delete_payments($form, $dbh);
1140
  }
1132 1141

  
1133 1142
  # Save the new payments the user made before cleaning up $form.
1134
  map { $payments{$_} = $form->{$_} } grep m/^datepaid_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^AR_paid_\d+$|^paidaccounts$/, keys %{ $form };
1143
  map { $payments{$_} = $form->{$_} } grep m/^datepaid_\d+$|^gldate_\d+$|^acc_trans_id_\d+$|^memo_\d+$|^source_\d+$|^exchangerate_\d+$|^paid_\d+$|^AR_paid_\d+$|^paidaccounts$/, keys %{ $form };
1135 1144

  
1136 1145
  # Clean up $form so that old content won't tamper the results.
1137 1146
  %keep_vars = map { $_, 1 } qw(login password id);
bin/mozilla/is.pl
195 195
      for my $i (1 .. scalar @{ $form->{acc_trans}{$key} }) {
196 196
        $form->{"AR_paid_$i"}      = "$form->{acc_trans}{$key}->[$i-1]->{accno}--$form->{acc_trans}{$key}->[$i-1]->{description}";
197 197

  
198
        $form->{"acc_trans_id_$i"}    = $form->{acc_trans}{$key}->[$i - 1]->{acc_trans_id};
198 199
        # reverse paid
199 200
        $form->{"paid_$i"}         = $form->{acc_trans}{$key}->[$i - 1]->{amount} * -1;
200 201
        $form->{"datepaid_$i"}     = $form->{acc_trans}{$key}->[$i - 1]->{transdate};
202
        $form->{"gldate_$i"}       = $form->{acc_trans}{$key}->[$i - 1]->{gldate};
201 203
        $form->{"exchangerate_$i"} = $form->{acc_trans}{$key}->[$i - 1]->{exchangerate};
202 204
        $form->{"forex_$i"}        = $form->{"exchangerate_$i"};
203 205
        $form->{"source_$i"}       = $form->{acc_trans}{$key}->[$i - 1]->{source};
......
427 429
  my $accno_arap = IS->get_standard_accno_current_assets(\%myconfig, \%$form);
428 430

  
429 431
  for my $i (1 .. $form->{paidaccounts}) {
432
    $form->{"changeable_$i"} = 1;
433
    if ($::lx_office_conf{features}->{payments_changeable} == 0) {
434
      # never
435
      $form->{"changeable_$i"} = ($form->{"acc_trans_id_$i"})? 0 : 1;
436
    } elsif ($::lx_office_conf{features}->{payments_changeable} == 2) {
437
      # on the same day
438
      $form->{"changeable_$i"} = (($form->{"gldate_$i"} eq '') || 
439
                                  ($form->current_date(\%myconfig) eq $form->{"gldate_$i"}));
440
    }
441

  
430 442
    $form->{"selectAR_paid_$i"} = $form->{selectAR_paid};
431 443
    if (!$form->{"AR_paid_$i"}) {
432 444
      $form->{"selectAR_paid_$i"} =~ s/option>$accno_arap--(.*?)</option selected>$accno_arap--$1</;
......
772 784

  
773 785
  $main::auth->assert('invoice_edit');
774 786

  
775
  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);
787
  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);
776 788
  $form->{paidaccounts} = 1;
777 789
  $form->{rowcount}--;
778 790
  $form->{invdate} = $form->current_date(\%myconfig);
......
811 823

  
812 824
  # Payments must not be recorded for the new storno invoice.
813 825
  $form->{paidaccounts} = 0;
814
  map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
826
  map { my $key = $_; delete $form->{$key} if grep { $key =~ /^$_/ } qw(datepaid_ gldate_ acc_trans_id_ source_ memo_ paid_ exchangerate_ AR_paid_) } keys %{ $form };
815 827

  
816 828
  $form->{storno_id} = $form->{id};
817 829
  $form->{storno} = 1;
......
934 946
    delete $form->{"source_$i"};
935 947
    delete $form->{"memo_$i"};
936 948
    delete $form->{"datepaid_$i"};
949
    delete $form->{"gldate_$i"};
950
    delete $form->{"acc_trans_id_$i"};
937 951
    delete $form->{"AR_paid_$i"};
938 952
  };
939 953
  $form->{paidaccounts} = 1;
templates/webpages/is/_payments.html
24 24

  
25 25

  
26 26
[% FOREACH i = paid_indices %]
27
  [% SET changeable    = 'changeable_'    _ i %]
28
  [% SET acc_trans_id  = 'acc_trans_id_'  _ i %]
29
  [% SET gldate        = 'gldate_'        _ i %]
27 30
  [% SET datepaid      = 'datepaid_'      _ i %]
28 31
  [% SET source        = 'source_'        _ i %]
29 32
  [% SET memo          = 'memo_'          _ i %]
30 33
  [% SET paid          = 'paid_'          _ i %]
34
  [% SET AR_paid       = 'AR_paid_'       _ i %]
31 35
  [% SET selectAR_paid_ref = 'selectAR_paid_' _ i %]
32 36

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

  
33 40
     <tr>
41
     <td align="center">
42
     [% IF $changeable %]
43
       <input id="datepaid_[% i %]" name="datepaid_[% i %]" size="11" title="[% dateformat %]" value="[% $datepaid %]">
44
       <input type="button" name="datepaid_[% i %]" id="trigger_datepaid_[% i %]" value="?">
45
     [% ELSE %]
46
       <input type="hidden" name="datepaid_[% i %]" value="[% $datepaid %]"> [% $datepaid %]
47
     [% END %]
48
     </td>
34 49

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

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

  
92
     <td align="center">
93
     [% IF $changeable %]
94
       <select name="AR_paid_[% i %]">[% $selectAR_paid_ref %]</select>
95
     [% ELSE %]
96
       <input type="hidden" name="AR_paid_[% i %]" value="[% $AR_paid %]">[% $AR_paid %]
97
     [% END %]
98
     </td>
56 99

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

  
64 109
[% END # foreach %]
65 110

  

Auch abrufbar als: Unified diff