Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0b5e2b1b

Von Bernd Bleßmann vor etwa 7 Jahren hinzugefügt

Bericht Lagerbuchungen: Richtige ids verwenden zur Anzeige des Dokuments

Beim Lagern über Lieferscheine steht die delivery_orders.id in inventory.oe_id
und beim Lagern über Rechnungen steht die invoice.id in inventory.invoice_id.
Lagern aus anderen Dokumenten als Lieferschein oder Rechnung gibt es nicht.

Unterschiede anzeigen:

SL/WH.pm
567 567
  my ($h_oe_id, $q_oe_id);
568 568
  if ($form->{l_oe_id}) {
569 569
    $q_oe_id = <<SQL;
570
      SELECT oe.id AS id,
571
        CASE WHEN oe.quotation THEN oe.quonumber ELSE oe.ordnumber END AS number,
572
        CASE
573
          WHEN oe.customer_id IS NOT NULL AND     COALESCE(oe.quotation, FALSE) THEN 'sales_quotation'
574
          WHEN oe.customer_id IS NOT NULL AND NOT COALESCE(oe.quotation, FALSE) THEN 'sales_order'
575
          WHEN oe.customer_id IS     NULL AND     COALESCE(oe.quotation, FALSE) THEN 'request_quotation'
576
          ELSE                                                                       'purchase_order'
577
        END AS type
578
      FROM oe
579
      WHERE oe.id = ?
580

  
581
      UNION
582

  
583 570
      SELECT dord.id AS id, dord.donumber AS number,
584 571
        CASE
585 572
          WHEN dord.customer_id IS NULL THEN 'purchase_delivery_order'
......
590 577

  
591 578
      UNION
592 579

  
593
      SELECT ar.id AS id, ar.invnumber AS number, 'sales_invoice' AS type
594
      FROM ar
595
      WHERE ar.id = ?
596

  
597
      UNION
598

  
599
      SELECT ap.id AS id, ap.invnumber AS number, 'purchase_invoice' AS type
600
      FROM ap
601
      WHERE ap.id = ?
602

  
603
      UNION
604

  
605 580
      SELECT ar.id AS id, ar.invnumber AS number, 'sales_invoice' AS type
606 581
      FROM ar
607 582
      WHERE ar.id = (SELECT trans_id FROM invoice WHERE id = ?)
......
632 607
    }
633 608

  
634 609
    if ($h_oe_id && ($ref->{oe_id} || $ref->{invoice_id})) {
635
      my $id = $ref->{oe_id} ? $ref->{oe_id} : $ref->{invoice_id};
636
      do_statement($form, $h_oe_id, $q_oe_id, ($id) x 6);
610
      do_statement($form, $h_oe_id, $q_oe_id, $ref->{oe_id}, ($ref->{invoice_id}) x 2);
637 611
      $ref->{oe_id_info} = $h_oe_id->fetchrow_hashref() || {};
638 612
    }
639 613

  

Auch abrufbar als: Unified diff