explain.depesz.com

PostgreSQL's explain analyze made readable

Result: SGfG

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 26,407.290 ↑ 1.0 1 1

Limit (cost=4,812,103.98..4,812,104.01 rows=1 width=8) (actual time=26,407.289..26,407.290 rows=1 loops=1)

  • Output: ($4)
  • Buffers: shared hit=89,748
2.          

Initplan (for Limit)

3. 0.129 26,407.279 ↑ 1.0 1 1

Aggregate (cost=4,812,103.97..4,812,103.98 rows=1 width=8) (actual time=26,407.279..26,407.279 rows=1 loops=1)

  • Output: count(*)
  • Buffers: shared hit=89,747
4. 5.176 26,407.150 ↑ 3.1 1,909 1

Sort (cost=4,812,014.01..4,812,029.01 rows=5,997 width=13,754) (actual time=26,407.037..26,407.150 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=89,747
5. 6.713 26,401.974 ↑ 3.1 1,909 1

Subquery Scan on payrollitem0 (cost=4,763,886.59..4,811,637.70 rows=5,997 width=13,754) (actual time=26,381.989..26,401.974 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=89,747
6. 5.493 26,387.625 ↑ 3.1 1,909 1

Unique (cost=4,763,886.59..4,770,153.45 rows=5,997 width=12,484) (actual time=26,381.934..26,387.625 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=72,518
7. 4.142 26,382.132 ↑ 3.1 1,909 1

Sort (cost=4,763,886.59..4,763,901.58 rows=5,997 width=12,484) (actual time=26,381.933..26,382.132 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=72,518
8. 1,631.298 26,377.990 ↑ 3.1 1,909 1

Finalize GroupAggregate (cost=579,205.29..4,763,510.28 rows=5,997 width=12,484) (actual time=3,902.110..26,377.990 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=72,518
9. 1,452.237 24,746.692 ↓ 1.4 16,422 1

Gather Merge (cost=579,205.29..4,641,801.16 rows=11,994 width=12,484) (actual time=3,873.110..24,746.692 rows=16,422 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=217,368
10. 19,094.975 23,294.455 ↑ 1.1 5,474 3 / 3

Partial GroupAggregate (cost=578,205.27..4,639,416.73 rows=5,997 width=12,484) (actual time=3,851.396..23,294.455 rows=5,474 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=217,368
  • Worker 0: actual time=3,840.951..22563.322 rows=5,474 loops=1
  • Buffers: shared hit=72,387
  • Worker 1: actual time=3,846.429..23443.784 rows=5,471 loops=1
  • Buffers: shared hit=72,463
11. 743.665 4,199.480 ↓ 1.0 1,371,984 3 / 3

Sort (cost=578,205.27..581,590.65 rows=1,354,155 width=31) (actual time=3,850.268..4,199.480 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: 158,811kB
  • Buffers: shared hit=217,368
  • Worker 0: actual time=3,839.516..4178.932 rows=1,334,036 loops=1
  • Buffers: shared hit=72,387
  • Worker 1: actual time=3,844.924..4190.241 rows=1,378,284 loops=1
  • Buffers: shared hit=72,463
12. 959.246 3,455.815 ↓ 1.0 1,371,984 3 / 3

Hash Join (cost=198,798.57..440,291.61 rows=1,354,155 width=31) (actual time=1,723.298..3,455.815 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=217,354
  • Worker 0: actual time=1,716.875..3451.245 rows=1,334,036 loops=1
  • Buffers: shared hit=72,380
  • Worker 1: actual time=1,717.753..3442.550 rows=1,378,284 loops=1
  • Buffers: shared hit=72,456
13. 787.317 787.317 ↑ 1.0 2,057,688 3 / 3

Parallel Index Scan using ixpri_paycodeidpaycodeid on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem8 (cost=0.43..236,047.88 rows=2,074,513 width=47) (actual time=0.050..787.317 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=17,408
  • Worker 0: actual time=0.057..787.373 rows=2,023,171 loops=1
  • Buffers: shared hit=5,728
  • Worker 1: actual time=0.056..780.957 rows=2,061,321 loops=1
  • Buffers: shared hit=5,804
14. 967.763 1,709.252 ↓ 1.0 4,115,953 3 / 3

Hash (cost=147,445.09..147,445.09 rows=4,108,244 width=16) (actual time=1,709.252..1,709.252 rows=4,115,953 loops=3)

  • Output: payrunpayrollitem9.payrollitemid
  • Buckets: 4,194,304 Batches: 1 Memory Usage: 225,704kB
  • Buffers: shared hit=199,926
  • Worker 0: actual time=1,702.746..1702.746 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
  • Worker 1: actual time=1,703.625..1703.625 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
15. 741.489 741.489 ↓ 1.0 4,115,953 3 / 3

Seq Scan on a6421d95b0a34a9e8f9812e0af8929f0.payrunpayrollitem payrunpayrollitem9 (cost=0.00..147,445.09 rows=4,108,244 width=16) (actual time=137.100..741.489 rows=4,115,953 loops=3)

  • Output: payrunpayrollitem9.payrollitemid
  • Filter: (payrunpayrollitem9.payrunid = '920453a8-89f8-47c7-b814-8aaf165a3181'::uuid)
  • Rows Removed by Filter: 2,348,294
  • Buffers: shared hit=199,926
  • Worker 0: actual time=138.052..737.289 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
  • Worker 1: actual time=136.882..732.066 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
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.001..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. 1.909 1.909 ↑ 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.001..0.001 rows=1 loops=1,909)

  • Output: login3.loginname
  • Index Cond: (login3.userid = payrollitem0.userid1)
  • Buffers: shared hit=5,743
20. 26,407.288 26,407.288 ↑ 6,293,671.0 1 1

Seq Scan on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem11 (cost=0.00..216,318.71 rows=6,293,671 width=8) (actual time=26,407.288..26,407.288 rows=1 loops=1)

  • Output: $4
  • Buffers: shared hit=89,748
Planning time : 153.609 ms
Execution time : 26,448.302 ms