Revision a9325fe9
Von Bernd Bleßmann vor mehr als 10 Jahren hinzugefügt
SL/CT.pm | ||
---|---|---|
76 | 76 |
"city" => "ct.city", |
77 | 77 |
"country" => "ct.country", |
78 | 78 |
"discount" => "ct.discount", |
79 |
"salesman" => "e.name" |
|
79 |
"salesman" => "e.name", |
|
80 |
"payment" => "pt.description" |
|
80 | 81 |
); |
81 | 82 |
|
82 | 83 |
$form->{sort} ||= "name"; |
... | ... | |
197 | 198 |
} |
198 | 199 |
|
199 | 200 |
my $query = |
200 |
qq|SELECT ct.*, b.description AS business, e.name as salesman | . |
|
201 |
qq|SELECT ct.*, b.description AS business, e.name as salesman, |. |
|
202 |
qq| pt.description as payment | . |
|
201 | 203 |
(qq|, NULL AS invnumber, NULL AS ordnumber, NULL AS quonumber, NULL AS invid, NULL AS module, NULL AS formtype, NULL AS closed | x!! $join_records) . |
202 | 204 |
qq|FROM $cv ct | . |
203 | 205 |
qq|LEFT JOIN business b ON (ct.business_id = b.id) | . |
204 | 206 |
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . |
207 |
qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | . |
|
205 | 208 |
qq|WHERE $where|; |
206 | 209 |
|
207 | 210 |
my @saved_values = @values; |
... | ... | |
215 | 218 |
push(@values, @saved_values); |
216 | 219 |
$query .= |
217 | 220 |
qq| UNION | . |
218 |
qq|SELECT ct.*, b.description AS business, e.name as salesman, | . |
|
221 |
qq|SELECT ct.*, b.description AS business, e.name as salesman, |. |
|
222 |
qq| pt.description as payment, | . |
|
219 | 223 |
qq| a.invnumber, a.ordnumber, a.quonumber, a.id AS invid, | . |
220 | 224 |
qq| '$module' AS module, 'invoice' AS formtype, | . |
221 | 225 |
qq| (a.amount = a.paid) AS closed | . |
... | ... | |
223 | 227 |
qq|JOIN $ar a ON (a.${cv}_id = ct.id) | . |
224 | 228 |
qq|LEFT JOIN business b ON (ct.business_id = b.id) | . |
225 | 229 |
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . |
230 |
qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | . |
|
226 | 231 |
qq|WHERE $where AND (a.invoice = '1')|; |
227 | 232 |
} |
228 | 233 |
|
... | ... | |
230 | 235 |
push(@values, @saved_values); |
231 | 236 |
$query .= |
232 | 237 |
qq| UNION | . |
233 |
qq|SELECT ct.*, b.description AS business, e.name as salesman, | . |
|
238 |
qq|SELECT ct.*, b.description AS business, e.name as salesman, |. |
|
239 |
qq| pt.description as payment, | . |
|
234 | 240 |
qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . |
235 | 241 |
qq| 'oe' AS module, 'order' AS formtype, o.closed | . |
236 | 242 |
qq|FROM $cv ct | . |
237 | 243 |
qq|JOIN oe o ON (o.${cv}_id = ct.id) | . |
238 | 244 |
qq|LEFT JOIN business b ON (ct.business_id = b.id) | . |
239 | 245 |
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . |
246 |
qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | . |
|
240 | 247 |
qq|WHERE $where AND (o.quotation = '0')|; |
241 | 248 |
} |
242 | 249 |
|
... | ... | |
245 | 252 |
$query .= |
246 | 253 |
qq| UNION | . |
247 | 254 |
qq|SELECT ct.*, b.description AS business, e.name as salesman, | . |
255 |
qq| pt.description as payment, | . |
|
248 | 256 |
qq| ' ' AS invnumber, o.ordnumber, o.quonumber, o.id AS invid, | . |
249 | 257 |
qq| 'oe' AS module, 'quotation' AS formtype, o.closed | . |
250 | 258 |
qq|FROM $cv ct | . |
251 | 259 |
qq|JOIN oe o ON (o.${cv}_id = ct.id) | . |
252 | 260 |
qq|LEFT JOIN business b ON (ct.business_id = b.id) | . |
253 | 261 |
qq|LEFT JOIN employee e ON (ct.salesman_id = e.id) | . |
262 |
qq|LEFT JOIN payment_terms pt ON (ct.payment_id = pt.id) | . |
|
254 | 263 |
qq|WHERE $where AND (o.quotation = '1')|; |
255 | 264 |
} |
256 | 265 |
} |
Auch abrufbar als: Unified diff
Kunden-/Lieferantenbericht: Zahlungsbegingungen anzeigen können.