explain.depesz.com

PostgreSQL's explain analyze made readable

Result: osh8

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

Limit (cost=4,917,146.10..4,917,146.16 rows=1 width=8) (actual time=32,951.881..32,951.881 rows=1 loops=1)

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

Initplan (for Limit)

3. 0.162 32,951.872 ↑ 1.0 1 1

Aggregate (cost=4,917,146.09..4,917,146.10 rows=1 width=8) (actual time=32,951.872..32,951.872 rows=1 loops=1)

  • Output: count(*)
  • Buffers: shared hit=1,538,622
4. 6.702 32,951.710 ↑ 3.1 1,909 1

Sort (cost=4,917,055.91..4,917,070.94 rows=6,012 width=13,754) (actual time=32,951.530..32,951.710 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,622
5. 7.527 32,945.008 ↑ 3.1 1,909 1

Subquery Scan on payrollitem0 (cost=4,868,808.00..4,916,678.55 rows=6,012 width=13,754) (actual time=32,921.036..32,945.008 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,622
6. 6.712 32,927.936 ↑ 3.1 1,909 1

Unique (cost=4,868,808.00..4,875,090.54 rows=6,012 width=12,484) (actual time=32,920.976..32,927.936 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,521,393
7. 5.467 32,921.224 ↑ 3.1 1,909 1

Sort (cost=4,868,808.00..4,868,823.03 rows=6,012 width=12,484) (actual time=32,920.975..32,921.224 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,521,393
8. 2,092.792 32,915.757 ↑ 3.1 1,909 1

Finalize GroupAggregate (cost=675,873.20..4,868,430.64 rows=6,012 width=12,484) (actual time=4,452.954..32,915.757 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,521,393
9. 2,351.145 30,822.965 ↓ 1.4 16,373 1

Gather Merge (cost=675,873.20..4,746,417.10 rows=12,024 width=12,484) (actual time=4,432.055..30,822.965 rows=16,373 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,957
10. 23,658.351 28,471.820 ↑ 1.1 5,458 3 / 3

Partial GroupAggregate (cost=674,873.18..4,744,029.20 rows=6,012 width=12,484) (actual time=4,404.791..28,471.820 rows=5,458 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,957
  • Worker 0: actual time=4,394.007..28671.211 rows=5,441 loops=1
  • Buffers: shared hit=1,520,956
  • Worker 1: actual time=4,394.669..28190.311 rows=5,446 loops=1
  • Buffers: shared hit=1,520,608
11. 829.186 4,813.469 ↓ 1.0 1,371,984 3 / 3

Sort (cost=674,873.18..678,265.19 rows=1,356,803 width=31) (actual time=4,403.456..4,813.469 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: 161,331kB
  • Buffers: shared hit=4,562,957
  • Worker 0: actual time=4,392.474..4801.915 rows=1,352,775 loops=1
  • Buffers: shared hit=1,520,956
  • Worker 1: actual time=4,394.006..4782.847 rows=1,327,291 loops=1
  • Buffers: shared hit=1,520,608
12. 1,060.058 3,984.283 ↓ 1.0 1,371,984 3 / 3

Hash Join (cost=148,649.08..536,670.72 rows=1,356,803 width=31) (actual time=2,117.282..3,984.283 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,943
  • Worker 0: actual time=2,059.112..3968.171 rows=1,352,775 loops=1
  • Buffers: shared hit=1,520,949
  • Worker 1: actual time=2,206.149..3986.811 rows=1,327,291 loops=1
  • Buffers: shared hit=1,520,601
13. 821.576 821.576 ↑ 1.0 2,057,688 3 / 3

Parallel Index Scan using ixpri_paycodeidpaycodeid on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem8 (cost=0.43..382,581.97 rows=2,072,420 width=47) (actual time=0.049..821.576 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,092
  • Worker 0: actual time=0.059..851.259 rows=2,040,113 loops=1
  • Buffers: shared hit=6,995
  • Worker 1: actual time=0.058..775.775 rows=1,961,690 loops=1
  • Buffers: shared hit=6,647
14. 1,081.938 2,102.649 ↑ 1.0 4,115,953 3 / 3

Hash (cost=97,137.36..97,137.36 rows=4,120,903 width=16) (actual time=2,102.649..2,102.649 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,044.476..2044.476 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
  • Worker 1: actual time=2,191.683..2191.683 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
15. 1,020.711 1,020.711 ↑ 1.0 4,115,953 3 / 3

Index Only Scan using uixprpri_payrunidpayrollitemid on a6421d95b0a34a9e8f9812e0af8929f0.payrunpayrollitem payrunpayrollitem9 (cost=0.56..97,137.36 rows=4,120,903 width=16) (actual time=0.091..1,020.711 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.115..989.477 rows=4,115,953 loops=1
  • Buffers: shared hit=1,513,944
  • Worker 1: actual time=0.117..1066.495 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. 1.909 1.909 ↑ 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.001 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,951.879 32,951.879 ↑ 6,294,384.0 1 1

Seq Scan on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem11 (cost=0.00..362,464.84 rows=6,294,384 width=8) (actual time=32,951.879..32,951.879 rows=1 loops=1)

  • Output: $4
  • Buffers: shared hit=1,538,623
Planning time : 153.025 ms
Execution time : 33,002.953 ms