explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nmJO

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 28,459.789 ↑ 1.0 1 1

Limit (cost=4,801,638.39..4,801,638.43 rows=1 width=8) (actual time=28,459.788..28,459.789 rows=1 loops=1)

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

Initplan (for Limit)

3. 0.130 28,459.780 ↑ 1.0 1 1

Aggregate (cost=4,801,638.38..4,801,638.39 rows=1 width=8) (actual time=28,459.780..28,459.780 rows=1 loops=1)

  • Output: count(*)
  • Buffers: shared hit=89,756
4. 5.566 28,459.650 ↑ 3.1 1,909 1

Sort (cost=4,801,548.20..4,801,563.23 rows=6,012 width=13,754) (actual time=28,459.506..28,459.650 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,756
5. 6.921 28,454.084 ↑ 3.1 1,909 1

Subquery Scan on payrollitem0 (cost=4,753,300.29..4,801,170.84 rows=6,012 width=13,754) (actual time=28,430.852..28,454.084 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,756
6. 6.575 28,437.618 ↑ 3.1 1,909 1

Unique (cost=4,753,300.29..4,759,582.83 rows=6,012 width=12,484) (actual time=28,430.800..28,437.618 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,527
7. 4.518 28,431.043 ↑ 3.1 1,909 1

Sort (cost=4,753,300.29..4,753,315.32 rows=6,012 width=12,484) (actual time=28,430.800..28,431.043 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,527
8. 1,741.620 28,426.525 ↑ 3.1 1,909 1

Finalize GroupAggregate (cost=579,326.84..4,752,922.93 rows=6,012 width=12,484) (actual time=4,033.394..28,426.525 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,527
9. 1,861.227 26,684.905 ↓ 1.4 16,413 1

Gather Merge (cost=579,326.84..4,630,909.39 rows=12,024 width=12,484) (actual time=3,998.207..26,684.905 rows=16,413 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,965
10. 20,484.941 24,823.678 ↑ 1.1 5,471 3 / 3

Partial GroupAggregate (cost=578,326.82..4,628,521.50 rows=6,012 width=12,484) (actual time=3,975.491..24,823.678 rows=5,471 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,965
  • Worker 0: actual time=3,967.716..24013.487 rows=5,461 loops=1
  • Buffers: shared hit=72,656
  • Worker 1: actual time=3,974.280..24700.198 rows=5,471 loops=1
  • Buffers: shared hit=72,782
11. 763.723 4,338.737 ↓ 1.0 1,371,984 3 / 3

Sort (cost=578,326.82..581,703.00 rows=1,350,472 width=31) (actual time=3,974.301..4,338.737 rows=1,371,984 loops=3)

  • Output: payrollitem8.userid, payrollitem8.paycodeid, payrollitem8.duration, payrollitem8.paycurrencyid, payrollitem8.payamount
  • Sort Key: payrollitem8.userid
  • Sort Method: quicksort Memory: 154,783kB
  • Buffers: shared hit=217,965
  • Worker 0: actual time=3,966.424..4330.881 rows=1,362,520 loops=1
  • Buffers: shared hit=72,656
  • Worker 1: actual time=3,972.445..4329.171 rows=1,401,368 loops=1
  • Buffers: shared hit=72,782
12. 1,004.533 3,575.014 ↓ 1.0 1,371,984 3 / 3

Hash Join (cost=198,798.57..440,814.79 rows=1,350,472 width=31) (actual time=1,774.097..3,575.014 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,951
  • Worker 0: actual time=1,758.216..3564.823 rows=1,362,520 loops=1
  • Buffers: shared hit=72,649
  • Worker 1: actual time=1,777.423..3570.574 rows=1,401,368 loops=1
  • Buffers: shared hit=72,775
13. 810.650 810.650 ↑ 1.0 2,057,688 3 / 3

Parallel Index Scan using ixpri_paycodeidpaycodeid on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem8 (cost=0.43..236,575.02 rows=2,073,003 width=47) (actual time=0.048..810.650 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: 43,461
  • Buffers: shared hit=18,005
  • Worker 0: actual time=0.055..812.580 rows=2,044,056 loops=1
  • Buffers: shared hit=5,997
  • Worker 1: actual time=0.054..804.517 rows=2,085,274 loops=1
  • Buffers: shared hit=6,123
14. 989.737 1,759.831 ↓ 1.0 4,115,953 3 / 3

Hash (cost=147,445.09..147,445.09 rows=4,108,244 width=16) (actual time=1,759.830..1,759.831 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,743.799..1743.799 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
  • Worker 1: actual time=1,763.094..1763.094 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
15. 770.094 770.094 ↓ 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=143.656..770.094 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=144.417..759.135 rows=4,115,953 loops=1
  • Buffers: shared hit=66,642
  • Worker 1: actual time=143.440..767.463 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.002..0.002 rows=1 loops=1,909)

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

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

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

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

  • Output: login3.loginname
  • Index Cond: (login3.userid = payrollitem0.userid1)
  • Buffers: shared hit=5,743
20. 28,459.787 28,459.787 ↑ 6,306,240.0 1 1

Seq Scan on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem11 (cost=0.00..216,912.40 rows=6,306,240 width=8) (actual time=28,459.787..28,459.787 rows=1 loops=1)

  • Output: $4
  • Buffers: shared hit=89,757
Planning time : 158.111 ms
Execution time : 28,504.896 ms