Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision df52f0a4

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

Kundenartikelnummern in Vorlagen verwenden können

Einsortierung in das template array wie Lieferantenartikelnummern als
customer_make und customer_model.

Standard-Druckvorlagen Angebot/Auftrag/Lieferschein/Rechnung für Verkauf
exemplarisch angepasst.

Unterschiede anzeigen:

SL/IC.pm
906 906

  
907 907
  $sth->finish();
908 908

  
909
  $query           = qq|SELECT
910
                        cp.parts_id,
911
                        cp.customer_partnumber AS customer_model,
912
                        c.name                 AS customer_make
913
                        FROM part_customer_prices cp
914
                        LEFT JOIN customer c ON (cp.customer_id = c.id)
915
                        WHERE cp.parts_id IN ($placeholders)|;
916

  
917
  my %customermodel = ();
918

  
919
  $sth              = prepare_execute_query($form, $dbh, $query, @part_ids);
920

  
921
  while (my $ref = $sth->fetchrow_hashref()) {
922
    $customermodel{$ref->{parts_id}} ||= [];
923
    push @{ $customermodel{$ref->{parts_id}} }, $ref;
924
  }
925

  
926
  $sth->finish();
927

  
909 928
  my @columns = qw(ean image microfiche drawing);
910 929

  
911 930
  $query      = qq|SELECT id, | . join(', ', @columns) . qq|
......
915 934
  my %data    = selectall_as_map($form, $dbh, $query, 'id', \@columns, @part_ids);
916 935

  
917 936
  my %template_arrays;
918
  map { $template_arrays{$_} = [] } (qw(make model), @columns);
937
  map { $template_arrays{$_} = [] } (qw(make model customer_make customer_model), @columns);
919 938

  
920 939
  foreach my $i (1 .. $rowcount) {
921 940
    my $id = $form->{"${prefix}${i}"};
......
929 948
    push @{ $template_arrays{make} },  [];
930 949
    push @{ $template_arrays{model} }, [];
931 950

  
932
    next if (!$makemodel{$id});
951
    if ($makemodel{$id}) {
952
      foreach my $ref (@{ $makemodel{$id} }) {
953
        map { push @{ $template_arrays{$_}->[-1] }, $ref->{$_} } qw(make model);
954
      }
955
    }
956

  
957
    push @{ $template_arrays{customer_make} },  [];
958
    push @{ $template_arrays{customer_model} }, [];
933 959

  
934
    foreach my $ref (@{ $makemodel{$id} }) {
935
      map { push @{ $template_arrays{$_}->[-1] }, $ref->{$_} } qw(make model);
960
    if ($customermodel{$id}) {
961
      foreach my $ref (@{ $customermodel{$id} }) {
962
        push @{ $template_arrays{$_}->[-1] }, $ref->{$_} for qw(customer_make customer_model);
963
      }
936 964
    }
965

  
937 966
  }
938 967

  
939 968
  my $parts = SL::DB::Manager::Part->get_all(query => [ id => \@part_ids ]);
templates/print/RB/deutsch.tex
23 23

  
24 24
\newcommand{\position} {Pos.}
25 25
\newcommand{\artikelnummer} {Art.-Nr.}
26
\newcommand{\kundenartnr} {Ihre Art.-Nr.}
26 27
\newcommand{\bild} {Bild}
27 28
\newcommand{\keinbild} {kein Bild}
28 29
\newcommand{\menge} {Menge}
templates/print/RB/english.tex
22 22

  
23 23
\newcommand{\position} {Pos.}
24 24
\newcommand{\artikelnummer} {Part No.}
25
\newcommand{\kundenartnr} {Your Part No.}
25 26
\newcommand{\bild} {Picture}
26 27
\newcommand{\keinbild} {n/a}
27 28
\newcommand{\menge} {Qty}
templates/print/RB/invoice.tex
157 157
          <%if serialnumber%> && \scriptsize \seriennummer: <%serialnumber%>\\<%end serialnumber%>
158 158
          <%if ean%> && \scriptsize \ean: <%ean%>\\<%end ean%>
159 159
          <%if projectnumber%> && \scriptsize \projektnummer: <%projectnumber%>\\<%end projectnumber%>
160
          <%if customer_make%>
161
            <%foreach customer_make%>
162
              \ifthenelse{\equal{<%customer_make%>}{<%name%>}}{&& \kundenartnr: <%customer_model%>\\}{}
163
            <%end foreach%>
164
          <%end if%>
160 165

  
161 166
          \\[-0.8em]
162 167
<%end number%>
templates/print/RB/sales_delivery_order.tex
126 126
          <%if serialnumber%> && \scriptsize \seriennummer: <%serialnumber%>\\<%end serialnumber%>
127 127
          <%if ean%> && \scriptsize \ean: <%ean%>\\<%end ean%>
128 128
          <%if projectnumber%> && \scriptsize \projektnummer: <%projectnumber%>\\<%end projectnumber%>
129
          <%if customer_make%>
130
            <%foreach customer_make%>
131
              \ifthenelse{\equal{<%customer_make%>}{<%name%>}}{&& \kundenartnr: <%customer_model%>\\}{}
132
            <%end foreach%>
133
          <%end if%>
129 134
          <%foreach si_number%><%if si_chargenumber%> && \scriptsize \charge: <%si_chargenumber%> <%if si_bestbefore%> \mhd: <%si_bestbefore%><%end if%> <%si_qty%>~<%si_unit%><%end si_chargenumber%>\\<%end si_number%>
130 135

  
131 136
          \\[-0.8em]
templates/print/RB/sales_order.tex
149 149
          <%if serialnumber%> && \scriptsize \seriennummer: <%serialnumber%>\\<%end serialnumber%>
150 150
          <%if ean%> && \scriptsize \ean: <%ean%>\\<%end ean%>
151 151
          <%if projectnumber%> && \scriptsize \projektnummer: <%projectnumber%>\\<%end projectnumber%>
152
          <%if customer_make%>
153
            <%foreach customer_make%>
154
              \ifthenelse{\equal{<%customer_make%>}{<%name%>}}{&& \kundenartnr: <%customer_model%>\\}{}
155
            <%end foreach%>
156
          <%end if%>
152 157
          \\[-0.8em]
153 158
<%end number%>
154 159

  
templates/print/RB/sales_quotation.tex
145 145
          <%if serialnumber%> && \scriptsize \seriennummer: <%serialnumber%>\\<%end serialnumber%>
146 146
          <%if ean%> && \scriptsize \ean: <%ean%>\\<%end ean%>
147 147
          <%if projectnumber%> && \scriptsize \projektnummer: <%projectnumber%>\\<%end projectnumber%>
148
          <%if customer_make%>
149
            <%foreach customer_make%>
150
              \ifthenelse{\equal{<%customer_make%>}{<%name%>}}{&& \kundenartnr: <%customer_model%>\\}{}
151
            <%end foreach%>
152
          <%end if%>
148 153
          \\[-0.8em]
149 154
<%end number%>
150 155

  

Auch abrufbar als: Unified diff