Revision 5cb3cbb6
Von Sven Schöling vor fast 13 Jahren hinzugefügt
SL/BP.pm | ||
---|---|---|
149 | 149 |
} else { |
150 | 150 |
$arap = "ar"; |
151 | 151 |
my $invoice = "a.invoice"; |
152 |
my $quonumber = "a.quonumber"; |
|
152 | 153 |
|
153 | 154 |
if ($form->{type} =~ /_(order|quotation)$/) { |
154 | 155 |
$invnumber = "ordnumber"; |
... | ... | |
156 | 157 |
$invoice = '0'; |
157 | 158 |
} |
158 | 159 |
|
160 |
if ($form->{type} eq 'packing_list') { |
|
161 |
$invnumber = "donumber"; |
|
162 |
$arap = "delivery_orders"; |
|
163 |
$invoice = '0'; |
|
164 |
$quonumber = '0'; |
|
165 |
} |
|
166 |
|
|
159 | 167 |
$query = |
160 |
qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, a.quonumber, | .
|
|
168 |
qq|SELECT a.id, a.$invnumber AS invnumber, a.ordnumber, $quonumber, | .
|
|
161 | 169 |
qq| a.transdate, $invoice AS invoice, '$arap' AS module, vc.name, | . |
162 | 170 |
qq| s.spoolfile | . |
163 | 171 |
qq|FROM $arap a, ${vc} vc, status s | . |
164 | 172 |
qq|WHERE s.trans_id = a.id | . |
165 | 173 |
qq| AND s.spoolfile IS NOT NULL | . |
166 |
qq| AND s.formname = ? | . |
|
174 |
($form->{type} eq 'packing_list' |
|
175 |
? qq| AND s.formname IN (?, ?) | |
|
176 |
: qq| AND s.formname = ? |) . |
|
167 | 177 |
qq| AND a.${vc}_id = vc.id|; |
168 | 178 |
@values = ($form->{type}); |
179 |
|
|
180 |
if ($form->{type} eq 'packing_list') { |
|
181 |
@values = qw(sales_delivery_order purchase_delivery_order); |
|
182 |
} |
|
169 | 183 |
} |
170 | 184 |
|
171 | 185 |
if ($form->{"${vc}_id"}) { |
... | ... | |
175 | 189 |
$query .= " AND vc.name ILIKE ?"; |
176 | 190 |
push(@values, $form->like($form->{ $vc })); |
177 | 191 |
} |
178 |
foreach my $column (qw(invnumber ordnumber quonumber)) { |
|
192 |
foreach my $column (qw(invnumber ordnumber quonumber donumber)) {
|
|
179 | 193 |
if ($form->{$column}) { |
180 | 194 |
$query .= " AND a.$column ILIKE ?"; |
181 | 195 |
push(@values, $form->like($form->{$column})); |
182 | 196 |
} |
183 | 197 |
} |
184 | 198 |
|
185 |
if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation)$/) { |
|
199 |
if ($form->{type} =~ /(invoice|sales_order|sales_quotation|puchase_order|request_quotation|packing_list)$/) {
|
|
186 | 200 |
if ($form->{transdatefrom}) { |
187 | 201 |
$query .= " AND a.transdate >= ?"; |
188 | 202 |
push(@values, $form->{transdatefrom}); |
... | ... | |
197 | 211 |
my $sortorder = join ', ', $form->sort_columns(@a); |
198 | 212 |
|
199 | 213 |
if (grep({ $_ eq $form->{sort} } |
200 |
qw(transdate invnumber ordnumber quonumber name))) { |
|
214 |
qw(transdate invnumber ordnumber quonumber donumber name))) {
|
|
201 | 215 |
$sortorder = $form->{sort}; |
202 | 216 |
} |
203 | 217 |
|
Auch abrufbar als: Unified diff
Drucken von Lieferscheinen über die Warteschlange