Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 3af5e2e0

Von Niclas Zimmermann vor mehr als 11 Jahren hinzugefügt

  • ID 3af5e2e0647403c1e6ee9b860d6a56d393e6e6f5
  • Vorgänger d1408ca1
  • Nachfolger dceb9f20

chart.link in der acc_trans

Enthält noch einige Ergänzungen zu commit
d1408ca13458a782cbde2b768cdd7abdbdcb9348. Es werden jetzt auch
periodisch erzeugte Rechnungen berücksichtigt und SEPA-Überweisungen
funktionieren wieder.

Weiterhin werden noch einige Syntax-Fehler behoben.

Unterschiede anzeigen:

SL/AP.pm
211 211
          qq|INSERT INTO acc_trans | .
212 212
          qq|  (trans_id, chart_id, amount, transdate, project_id, taxkey, tax_id, chart_link)| .
213 213
          qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
214
          qq|  ?, ?, ?, ?, ?| .
214
          qq|  ?, ?, ?, ?, ?,| .
215 215
          qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
216 216
        @values = ($form->{id}, $form->{AP_amounts}{"amount_$i"},
217 217
                   $form->{"amount_$i"}, conv_date($form->{transdate}),
......
225 225
            qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, | .
226 226
            qq|  project_id, taxkey, tax_id, chart_link) | .
227 227
            qq|VALUES (?, (SELECT c.id FROM chart c WHERE c.accno = ?), | .
228
            qq|  ?, ?, ?, ?, ?)| .
228
            qq|  ?, ?, ?, ?, ?,| .
229 229
            qq| (SELECT c.link FROM chart c WHERE c.accno = ?))|;
230 230
          @values = ($form->{id}, $form->{AP_amounts}{"tax_$i"},
231 231
                     $form->{"tax_$i"}, conv_date($form->{transdate}),
SL/DB/Invoice.pm
170 170
  my ($self, $entries) = @_;
171 171

  
172 172
  my $default_tax_id = SL::DB::Manager::Tax->find_by(taxkey => 0)->id;
173
  my $chart_link;
173 174

  
174 175
  while (my ($chart_id, $spec) = each %{ $entries }) {
175 176
    $spec = { taxkey => 0, tax_id => $default_tax_id, amount => $spec } unless ref $spec;
177
    $chart_link = SL::DB::Manager::Chart->find_by(id => $chart_id)->{'link'};
178
    $chart_link ||= '';
179

  
176 180
    SL::DB::AccTransaction->new(trans_id   => $self->id,
177 181
                                chart_id   => $chart_id,
178 182
                                amount     => $spec->{amount},
179 183
                                tax_id     => $spec->{tax_id},
180 184
                                taxkey     => $spec->{taxkey},
181 185
                                project_id => $self->globalproject_id,
182
                                transdate  => $self->transdate)->save;
186
                                transdate  => $self->transdate,
187
                                chart_link => $chart_link)->save;
183 188
  }
184 189
}
185 190

  
SL/DB/MetaSetup/AccTransaction.pm
27 27
    itime          => { type => 'timestamp', default => 'now()' },
28 28
    mtime          => { type => 'timestamp' },
29 29
    tax_id         => { type => 'integer', not_null => 1 },
30
    chart_link     => { type => 'text', not_null => 1 },
30 31
  ],
31 32

  
32 33
  primary_key_columns => [ 'acc_trans_id' ],
......
41 42
      class       => 'SL::DB::Project',
42 43
      key_columns => { project_id => 'id' },
43 44
    },
45

  
46
    tax => {
47
      class       => 'SL::DB::Tax',
48
      key_columns => { tax_id => 'id' },
49
    },
44 50
  ],
45 51
);
46 52

  
SL/GL.pm
171 171
        qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate,
172 172
                                  source, memo, project_id, taxkey, tax_id, chart_link)
173 173
           VALUES (?, (SELECT chart_id FROM tax WHERE id = ?),
174
                   ?, ?, ?, ?, ?, ?, ?, (SELECT link FROM chart WHERE accno = ?))|;
174
                   ?, ?, ?, ?, ?, ?, ?, (SELECT link 
175
                                         FROM chart 
176
                                         WHERE id = (SELECT chart_id 
177
                                                     FROM tax 
178
                                                     WHERE id = ?)))|;
175 179
      @values = (conv_i($form->{id}), conv_i($form->{"tax_id_$i"}),
176 180
                 $tax, conv_date($form->{transdate}), $form->{"source_$i"},
177 181
                 $form->{"memo_$i"}, $project_id, $taxkey, conv_i($form->{"tax_id_$i"}), conv_i($form->{"tax_id_$i"}));
SL/SEPA.pm
357 357
                               AND ((c.link LIKE '%:${ARAP}') OR (c.link LIKE '${ARAP}:%') OR (c.link = '${ARAP}'))
358 358
                             LIMIT 1| ],
359 359

  
360
    'add_acc_trans'  => [ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate,       source, memo, taxkey, tax_id)
361
                             VALUES                (?,        ?,        ?,      ?,         current_date, ?,      '',   0,      (SELECT id FROM tax WHERE taxkey=0 LIMIT 1))| ],
360
    'add_acc_trans'  => [ qq|INSERT INTO acc_trans (trans_id, chart_id, amount, transdate, gldate,       source, memo, taxkey, tax_id ,                                     chart_link)
361
                             VALUES                (?,        ?,        ?,      ?,         current_date, ?,      '',   0,      (SELECT id FROM tax WHERE taxkey=0 LIMIT 1), (SELECT link FROM chart WHERE id=?))| ],
362 362

  
363 363
    'update_arap'    => [ qq|UPDATE ${arap}
364 364
                             SET paid = paid + ?
......
397 397
    my ($arap_chart_id) = $handles{get_arap}->[0]->fetchrow_array();
398 398

  
399 399
    # Record the payment in acc_trans offsetting AR/AP.
400
    do_statement($form, @{ $handles{add_acc_trans} }, $orig_item->{"${arap}_id"}, $arap_chart_id,         -1 * $mult * $orig_item->{amount}, $item->{execution_date}, '');
401
    do_statement($form, @{ $handles{add_acc_trans} }, $orig_item->{"${arap}_id"}, $orig_item->{chart_id},      $mult * $orig_item->{amount}, $item->{execution_date}, $orig_item->{reference});
400
    do_statement($form, @{ $handles{add_acc_trans} }, $orig_item->{"${arap}_id"}, $arap_chart_id,         -1 * $mult * $orig_item->{amount}, $item->{execution_date}, '', $arap_chart_id);
401
    do_statement($form, @{ $handles{add_acc_trans} }, $orig_item->{"${arap}_id"}, $orig_item->{chart_id},      $mult * $orig_item->{amount}, $item->{execution_date}, $orig_item->{reference}, 
402
                                                      $orig_item->{chart_id});
402 403

  
403 404
    # Update the invoice to reflect the new paid amount.
404 405
    do_statement($form, @{ $handles{update_arap} }, $orig_item->{amount}, $orig_item->{"${arap}_id"});

Auch abrufbar als: Unified diff