Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 96d60de4

Von Sven Schöling vor etwa 15 Jahren hinzugefügt

  • ID 96d60de4d387a1e821b25a47e07c269995959b0f
  • Vorgänger 875f08f3
  • Nachfolger d8f857c7

Buchungskonten in Verkaufsrechnungen anzeigen.

Unterschiede anzeigen:

SL/AR.pm
407 407
  my ($self, $myconfig, $form) = @_;
408 408

  
409 409
  # connect to database
410
  my $dbh = $form->dbconnect($myconfig);
410
  my $dbh = $form->get_standard_dbh($myconfig);
411 411

  
412 412
  my @values;
413 413

  
414 414
  my $query =
415
    qq|SELECT a.id, a.invnumber, a.ordnumber, a.transdate, | .
415
    qq|SELECT DISTINCT a.id, a.invnumber, a.ordnumber, a.transdate, | .
416 416
    qq|  a.duedate, a.netamount, a.amount, a.paid, | .
417 417
    qq|  a.invoice, a.datepaid, a.terms, a.notes, a.shipvia, | .
418 418
    qq|  a.shippingpoint, a.storno, a.storno_id, a.globalproject_id, | .
......
423 423
    qq|  e.name AS employee, | .
424 424
    qq|  e2.name AS salesman, | .
425 425
    qq|  tz.description AS taxzone, | .
426
    qq|  pt.description AS payment_terms | .
426
    qq|  pt.description AS payment_terms, | .
427
    qq{  ch.accno || ' -- ' || ch.description AS charts } .
427 428
    qq|FROM ar a | .
428 429
    qq|JOIN customer c ON (a.customer_id = c.id) | .
429 430
    qq|LEFT JOIN employee e ON (a.employee_id = e.id) | .
430 431
    qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | .
431 432
    qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| .
432 433
    qq|LEFT JOIN tax_zones tz ON (tz.id = c.taxzone_id)| .
433
    qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)|;
434
    qq|LEFT JOIN payment_terms pt ON (pt.id = c.payment_id)| .
435
    qq|LEFT JOIN acc_trans at ON (at.trans_id = a.id)| .
436
    qq|INNER JOIN chart ch ON (ch.id = at.chart_id AND ch.link ~ 'AR[[:>:]]')|;
434 437

  
435 438
  my $where = "1 = 1";
436 439
  if ($form->{customer_id}) {
......
485 488

  
486 489
  $query .= " WHERE $where ORDER BY $sortorder";
487 490

  
488
  my $sth = $dbh->prepare($query);
489
  $sth->execute(@values) ||
490
    $form->dberror($query . " (" . join(", ", @values) . ")");
491
  my @result = selectall_hashref_query($form, $dbh, $query, @values);
491 492

  
492
  $form->{AR} = [];
493
  while (my $ar = $sth->fetchrow_hashref(NAME_lc)) {
494
    push @{ $form->{AR} }, $ar;
495
  }
496

  
497
  $sth->finish;
498
  $dbh->disconnect;
493
  $form->{AR} = [ @result ];
499 494

  
500 495
  $main::lxdebug->leave_sub();
501 496
}

Auch abrufbar als: Unified diff