Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 41cceb1e

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID 41cceb1e99fa9d9dbf7977772e16e23646208608
  • Vorgänger 9fbc6ff4
  • Nachfolger 0fa80981

Debitorenbuchungen auf Verwendung des Chart-Pickers umgestellt

Unterschiede anzeigen:

SL/IS.pm
2203 2203
  }
2204 2204
  $sth->finish;
2205 2205

  
2206
  # setup last accounts used for this customer
2207
  if (!$form->{id} && $form->{type} !~ /_(order|quotation)/) {
2208
    $query =
2209
      qq|SELECT c.id, c.accno, c.description, c.link, c.category
2210
         FROM chart c
2211
         JOIN acc_trans ac ON (ac.chart_id = c.id)
2212
         JOIN ar a ON (a.id = ac.trans_id)
2213
         WHERE a.customer_id = ?
2214
           AND NOT (c.link LIKE '%_tax%' OR c.link LIKE '%_paid%')
2215
           AND a.id IN (SELECT max(a2.id) FROM ar a2 WHERE a2.customer_id = ?)|;
2216
    $sth = prepare_execute_query($form, $dbh, $query, $cid, $cid);
2217

  
2218
    my $i = 0;
2219
    while ($ref = $sth->fetchrow_hashref('NAME_lc')) {
2220
      if ($ref->{category} eq 'I') {
2221
        $i++;
2222
        $form->{"AR_amount_$i"} = "$ref->{accno}--$ref->{description}";
2223

  
2224
        if ($form->{initial_transdate}) {
2225
          my $tax_query =
2226
            qq|SELECT tk.tax_id, t.rate
2227
               FROM taxkeys tk
2228
               LEFT JOIN tax t ON tk.tax_id = t.id
2229
               WHERE (tk.chart_id = ?) AND (startdate <= date(?))
2230
               ORDER BY tk.startdate DESC
2231
               LIMIT 1|;
2232
          my ($tax_id, $rate) =
2233
            selectrow_query($form, $dbh, $tax_query, $ref->{id},
2234
                            $form->{initial_transdate});
2235
          $form->{"taxchart_$i"} = "${tax_id}--${rate}";
2236
        }
2237
      }
2238
      if ($ref->{category} eq 'A') {
2239
        $form->{ARselected} = $form->{AR_1} = $ref->{accno};
2240
      }
2241
    }
2242
    $sth->finish;
2243
    $form->{rowcount} = $i if ($i && !$form->{type});
2244
  }
2245

  
2246 2206
  $main::lxdebug->leave_sub();
2247 2207
}
2248 2208

  

Auch abrufbar als: Unified diff