explain.depesz.com

PostgreSQL's explain analyze made readable

Result: cGug : AssuredPartnersInctrial03_afteranalyze

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 32,779.981 ↑ 1.0 1 1

Limit (cost=4,916,306.16..4,916,306.22 rows=1 width=8) (actual time=32,779.980..32,779.981 rows=1 loops=1)

  • Output: ($4)
  • Buffers: shared hit=1,538,224 read=780
2.          

Initplan (for Limit)

3. 0.163 32,779.971 ↑ 1.0 1 1

Aggregate (cost=4,916,306.15..4,916,306.16 rows=1 width=8) (actual time=32,779.970..32,779.971 rows=1 loops=1)

  • Output: count(*)
  • Buffers: shared hit=1,538,223 read=780
4. 6.377 32,779.808 ↑ 3.1 1,909 1

Sort (cost=4,916,216.93..4,916,231.80 rows=5,948 width=13,754) (actual time=32,779.644..32,779.808 rows=1,909 loops=1)

  • Output: NULL::integer, ((SubPlan 1)), ((SubPlan 2)), ((SubPlan 3)), NULL::boolean, NULL::character varying(255) COLLATE "en_US", NULL::boolean, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric
  • Sort Key: ((SubPlan 2)) COLLATE "en_US", ((SubPlan 1)) COLLATE "en_US", ((SubPlan 3)) COLLATE "en_US
  • Sort Method: quicksort Memory: 318kB
  • Buffers: shared hit=1,538,223 read=780
5. 7.378 32,773.431 ↑ 3.1 1,909 1

Subquery Scan on payrollitem0 (cost=4,868,483.10..4,915,844.05 rows=5,948 width=13,754) (actual time=32,746.894..32,773.431 rows=1,909 loops=1)

  • Output: NULL::integer, (SubPlan 1), (SubPlan 2), (SubPlan 3), NULL::boolean, NULL::character varying(255) COLLATE "en_US", NULL::boolean, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric
  • Buffers: shared hit=1,538,223 read=780
6. 7.483 32,754.599 ↑ 3.1 1,909 1

Unique (cost=4,868,483.10..4,874,698.76 rows=5,948 width=12,484) (actual time=32,746.839..32,754.599 rows=1,909 loops=1)

  • Output: payrollitem8.userid, (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END)
  • Buffers: shared hit=1,520,994 read=780
7. 5.403 32,747.116 ↑ 3.1 1,909 1

Sort (cost=4,868,483.10..4,868,497.97 rows=5,948 width=12,484) (actual time=32,746.838..32,747.116 rows=1,909 loops=1)

  • Output: payrollitem8.userid, (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END)
  • Sort Key: payrollitem8.userid, (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END), (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END)
  • Sort Method: quicksort Memory: 322kB
  • Buffers: shared hit=1,520,994 read=780
8. 2,013.680 32,741.713 ↑ 3.1 1,909 1

Finalize GroupAggregate (cost=676,071.74..4,868,110.21 rows=5,948 width=12,484) (actual time=5,203.471..32,741.713 rows=1,909 loops=1)

  • Output: payrollitem8.userid, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END, CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END
  • Group Key: payrollitem8.userid
  • Filter: ((CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) <> '00:00:00'::interval) THEN sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END) ELSE NULL::interval END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL) OR (CASE WHEN (sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) <> '0'::numeric) THEN sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END) ELSE NULL::numeric END IS NOT NULL))
  • Rows Removed by Filter: 3,676
  • Buffers: shared hit=1,520,994 read=780
9. 2,522.433 30,728.033 ↓ 1.4 16,401 1

Gather Merge (cost=676,071.74..4,747,395.55 rows=11,896 width=12,484) (actual time=5,161.811..30,728.033 rows=16,401 loops=1)

  • Output: payrollitem8.userid, (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END)), (PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END))
  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=4,562,959 read=2,337
10. 22,693.067 28,205.600 ↑ 1.1 5,467 3 / 3

Partial GroupAggregate (cost=675,071.71..4,745,022.43 rows=5,948 width=12,484) (actual time=5,118.442..28,205.600 rows=5,467 loops=3)

  • Output: payrollitem8.userid, PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)
  • Group Key: payrollitem8.userid
  • Buffers: shared hit=4,562,959 read=2,337
  • Worker 0: actual time=5,097.483..26988.782 rows=5,482 loops=1
  • Buffers: shared hit=1,520,596 read=774
  • Worker 1: actual time=5,126.871..30532.557 rows=5,463 loops=1
  • Buffers: shared hit=1,521,369 read=783
11. 893.512 5,512.533 ↓ 1.0 1,371,984 3 / 3

Sort (cost=675,071.71..678,464.43 rows=1,357,088 width=31) (actual time=5,116.957..5,512.533 rows=1,371,984 loops=3)

  • Output: payrollitem8.userid, payrollitem8.paycodeid, payrollitem8.duration, payrollitem8.paycurrencyid, payrollitem8.payamount
  • Sort Key: payrollitem8.userid
  • Sort Method: quicksort Memory: 154,475kB
  • Buffers: shared hit=4,562,959 read=2,337
  • Worker 0: actual time=5,095.907..5461.695 rows=1,285,248 loops=1
  • Buffers: shared hit=1,520,596 read=774
  • Worker 1: actual time=5,124.685..5552.104 rows=1,482,571 loops=1
  • Buffers: shared hit=1,521,369 read=783
12. 1,214.604 4,619.021 ↓ 1.0 1,371,984 3 / 3

Hash Join (cost=148,809.43..536,838.17 rows=1,357,088 width=31) (actual time=2,218.549..4,619.021 rows=1,371,984 loops=3)

  • Output: payrollitem8.userid, payrollitem8.paycodeid, payrollitem8.duration, payrollitem8.paycurrencyid, payrollitem8.payamount
  • Inner Unique: true
  • Hash Cond: (payrollitem8.id = payrunpayrollitem9.payrollitemid)
  • Buffers: shared hit=4,562,945 read=2,337
  • Worker 0: actual time=2,357.931..4624.645 rows=1,285,248 loops=1
  • Buffers: shared hit=1,520,589 read=774
  • Worker 1: actual time=2,119.546..4600.684 rows=1,482,571 loops=1
  • Buffers: shared hit=1,521,362 read=783
13. 1,201.959 1,201.959 ↑ 1.0 2,057,688 3 / 3

Parallel Index Scan using ixpri_paycodeidpaycodeid on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem8 (cost=0.43..382,595.75 rows=2,069,875 width=47) (actual time=0.054..1,201.959 rows=2,057,688 loops=3)

  • Output: payrollitem8.id, payrollitem8.userid, payrollitem8.paycodeid, payrollitem8.entrydate, payrollitem8.duration, payrollitem8.payamount, payrollitem8.paycurrencyid, payrollitem8.originuri, payrollitem8.payableitemid
  • Index Cond: ((payrollitem8.paycodeid IS NOT NULL) AND (payrollitem8.paycodeid = ANY ('{2,6,8,9,5,14,15,16,19,20,21,18,12,22,17,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,59,92,93,7,10,125,11,1,126,127,128,129,130,131,132,134,135,3,4,158,159}'::integer[])))
  • Filter: ((payrollitem8.userid <> 1) AND (payrollitem8.entrydate <= '2019-04-28'::date))
  • Rows Removed by Filter: 39,404
  • Buffers: shared hit=21,094 read=2,337
  • Worker 0: actual time=0.067..1129.919 rows=1,925,099 loops=1
  • Buffers: shared hit=6,635 read=774
  • Worker 1: actual time=0.065..1243.498 rows=2,188,472 loops=1
  • Buffers: shared hit=7,408 read=783
14. 1,128.209 2,202.458 ↑ 1.0 4,115,953 3 / 3

Hash (cost=97,242.15..97,242.15 rows=4,125,348 width=16) (actual time=2,202.457..2,202.458 rows=4,115,953 loops=3)

  • Output: payrunpayrollitem9.payrollitemid
  • Buckets: 4,194,304 Batches: 1 Memory Usage: 225,704kB
  • Buffers: shared hit=4,541,831
  • Worker 0: actual time=2,342.641..2342.641 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
  • Worker 1: actual time=2,104.332..2104.332 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
15. 1,074.249 1,074.249 ↑ 1.0 4,115,953 3 / 3

Index Only Scan using uixprpri_payrunidpayrollitemid on a6421d95b0a34a9e8f9812e0af8929f0.payrunpayrollitem payrunpayrollitem9 (cost=0.56..97,242.15 rows=4,125,348 width=16) (actual time=0.177..1,074.249 rows=4,115,953 loops=3)

  • Output: payrunpayrollitem9.payrollitemid
  • Index Cond: (payrunpayrollitem9.payrunid = '920453a8-89f8-47c7-b814-8aaf165a3181'::uuid)
  • Heap Fetches: 0
  • Buffers: shared hit=4,541,831
  • Worker 0: actual time=0.348..1167.201 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
  • Worker 1: actual time=0.129..1016.222 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
16.          

SubPlan (for Subquery Scan)

17. 3.818 3.818 ↑ 1.0 1 1,909

Index Scan using userinfo_pkey on a6421d95b0a34a9e8f9812e0af8929f0.userinfo userinfo1 (cost=0.29..2.30 rows=1 width=118) (actual time=0.002..0.002 rows=1 loops=1,909)

  • Output: userinfo1.firstname
  • Index Cond: (userinfo1.id = payrollitem0.userid1)
  • Buffers: shared hit=5,743
18. 3.818 3.818 ↑ 1.0 1 1,909

Index Scan using userinfo_pkey on a6421d95b0a34a9e8f9812e0af8929f0.userinfo userinfo2 (cost=0.29..2.30 rows=1 width=118) (actual time=0.001..0.002 rows=1 loops=1,909)

  • Output: userinfo2.lastname
  • Index Cond: (userinfo2.id = payrollitem0.userid1)
  • Buffers: shared hit=5,743
19. 3.818 3.818 ↑ 1.0 1 1,909

Index Scan using login_pkey on a6421d95b0a34a9e8f9812e0af8929f0.login login3 (cost=0.29..2.30 rows=1 width=516) (actual time=0.002..0.002 rows=1 loops=1,909)

  • Output: login3.loginname
  • Index Cond: (login3.userid = payrollitem0.userid1)
  • Buffers: shared hit=5,743
20. 32,779.979 32,779.979 ↑ 6,292,118.0 1 1

Seq Scan on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem11 (cost=0.00..362,442.18 rows=6,292,118 width=8) (actual time=32,779.979..32,779.979 rows=1 loops=1)

  • Output: $4
  • Buffers: shared hit=1,538,224 read=780
Planning time : 176.388 ms
Execution time : 32,833.080 ms