Revision 7a803ab2
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/CustomerVendorTurnover.pm | ||
---|---|---|
8 | 8 |
use SL::DB::AccTransaction; |
9 | 9 |
use SL::DB::Invoice; |
10 | 10 |
use SL::DB::Order; |
11 |
use SL::DB::Order::TypeData qw(:types); |
|
11 | 12 |
use SL::DB::EmailJournal; |
12 | 13 |
use SL::DB::Letter; |
13 | 14 |
use SL::DB; |
... | ... | |
282 | 283 |
$orders = SL::DB::Manager::Order->get_all( |
283 | 284 |
query => [ |
284 | 285 |
customer_id => $cv, |
285 |
quotation => ($type eq 'quotation' ? 'T' : 'F')
|
|
286 |
record_type => ($type eq 'quotation' ? SALES_QUOTATION_TYPE() : SALES_ORDER_TYPE())
|
|
286 | 287 |
], |
287 | 288 |
sort_by => 'transdate DESC', |
288 | 289 |
); |
... | ... | |
290 | 291 |
$orders = SL::DB::Manager::Order->get_all( |
291 | 292 |
query => [ |
292 | 293 |
vendor_id => $cv, |
293 |
quotation => ($type eq 'quotation' ? 'T' : 'F')
|
|
294 |
record_type => ($type eq 'quotation' ? REQUEST_QUOTATION_TYPE() : PURCHASE_ORDER_TYPE())
|
|
294 | 295 |
], |
295 | 296 |
sort_by => 'transdate DESC', |
296 | 297 |
); |
... | ... | |
346 | 347 |
$query = <<SQL; |
347 | 348 |
WITH |
348 | 349 |
oe_emails_customer |
349 |
AS (SELECT rc.to_id, rc.from_id, oe.quotation, oe.quonumber, oe.ordnumber, c.id
|
|
350 |
AS (SELECT rc.to_id, rc.from_id, oe.record_type, oe.quonumber, oe.ordnumber, c.id
|
|
350 | 351 |
FROM record_links rc |
351 | 352 |
LEFT JOIN oe oe ON rc.from_id = oe.id |
352 | 353 |
LEFT JOIN customer c ON oe.customer_id = c.id |
... | ... | |
379 | 380 |
|
380 | 381 |
SELECT ej.*, |
381 | 382 |
CASE |
382 |
oec.quotation WHEN 'F' THEN 'Sales Order'
|
|
383 |
ELSE 'Quotation' |
|
383 |
oec.record_type WHEN 'sales_order' THEN 'Sales Order'
|
|
384 |
ELSE 'Quotation'
|
|
384 | 385 |
END AS type, |
385 | 386 |
CASE |
386 |
oec.quotation WHEN 'F' THEN oec.ordnumber
|
|
387 |
ELSE oec.quonumber |
|
387 |
oec.record_type WHEN 'sales_order' THEN oec.ordnumber
|
|
388 |
ELSE oec.quonumber
|
|
388 | 389 |
END AS recordnumber, |
389 | 390 |
oec.id AS record_id |
390 | 391 |
FROM email_journal ej |
... | ... | |
425 | 426 |
$query = <<SQL; |
426 | 427 |
WITH |
427 | 428 |
oe_emails_vendor |
428 |
AS (SELECT rc.to_id, rc.from_id, oe.quotation, oe.quonumber, oe.ordnumber, c.id
|
|
429 |
AS (SELECT rc.to_id, rc.from_id, oe.record_type, oe.quonumber, oe.ordnumber, c.id
|
|
429 | 430 |
FROM record_links rc |
430 | 431 |
LEFT JOIN oe oe ON rc.from_id = oe.id |
431 | 432 |
LEFT JOIN vendor c ON oe.vendor_id = c.id |
... | ... | |
458 | 459 |
|
459 | 460 |
SELECT ej.*, |
460 | 461 |
CASE |
461 |
oec.quotation WHEN 'F' THEN 'Purchase Order'
|
|
462 |
ELSE 'Request quotation' |
|
462 |
oec.record_type WHEN 'purchase_order' THEN 'Purchase Order'
|
|
463 |
ELSE 'Request quotation'
|
|
463 | 464 |
END AS type, |
464 | 465 |
CASE |
465 |
oec.quotation WHEN 'F' THEN oec.ordnumber
|
|
466 |
ELSE oec.quonumber |
|
466 |
oec.record_type WHEN 'purchase_order' THEN oec.ordnumber
|
|
467 |
ELSE oec.quonumber
|
|
467 | 468 |
END AS recordnumber, |
468 | 469 |
oec.id AS record_id |
469 | 470 |
FROM email_journal ej |
Auch abrufbar als: Unified diff
Angebotsflag/Intakeflag aus Datenbankzugriffen entfernt