explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sgPL : AssuredPartnersInctrial03_before

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 97,239.397 ↑ 1.0 1 1

Limit (cost=4,905,588.58..4,905,588.63 rows=1 width=8) (actual time=97,239.397..97,239.397 rows=1 loops=1)

  • Output: ($4)
  • Buffers: shared hit=1,522,341 read=71,047
2.          

Initplan (for Limit)

3. 0.128 97,231.207 ↑ 1.0 1 1

Aggregate (cost=4,905,588.57..4,905,588.58 rows=1 width=8) (actual time=97,231.206..97,231.207 rows=1 loops=1)

  • Output: count(*)
  • Buffers: shared hit=1,522,341 read=71,046
4. 5.801 97,231.079 ↑ 3.1 1,909 1

Sort (cost=4,905,498.49..4,905,513.50 rows=6,005 width=13,754) (actual time=97,230.959..97,231.079 rows=1,909 loops=1)

  • Output: NULL::integer, ((SubPlan 1)), ((SubPlan 2)), ((SubPlan 3)), NULL::boolean, NULL::character varying(255) COLLATE "en_US", NULL::boolean, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric
  • Sort Key: ((SubPlan 2)) COLLATE "en_US", ((SubPlan 1)) COLLATE "en_US", ((SubPlan 3)) COLLATE "en_US
  • Sort Method: quicksort Memory: 318kB
  • Buffers: shared hit=1,522,341 read=71,046
5. 9.484 97,225.278 ↑ 3.1 1,909 1

Subquery Scan on payrollitem0 (cost=4,857,306.81..4,905,121.62 rows=6,005 width=13,754) (actual time=96,443.124..97,225.278 rows=1,909 loops=1)

  • Output: NULL::integer, (SubPlan 1), (SubPlan 2), (SubPlan 3), NULL::boolean, NULL::character varying(255) COLLATE "en_US", NULL::boolean, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::interval, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric, NULL::numeric
  • Buffers: shared hit=1,522,334 read=71,046
6. 6.861 96,448.376 ↑ 3.1 1,909 1

Unique (cost=4,857,306.81..4,863,582.03 rows=6,005 width=12,484) (actual time=96,441.211..96,448.376 rows=1,909 loops=1)

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

Sort (cost=4,857,306.81..4,857,321.82 rows=6,005 width=12,484) (actual time=96,441.210..96,441.515 rows=1,909 loops=1)

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

Finalize GroupAggregate (cost=674,906.29..4,856,929.93 rows=6,005 width=12,484) (actual time=65,980.639..96,435.380 rows=1,909 loops=1)

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

Gather Merge (cost=674,906.29..4,735,058.46 rows=12,010 width=12,484) (actual time=65,948.938..94,066.333 rows=16,389 loops=1)

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

Partial GroupAggregate (cost=673,906.26..4,732,672.18 rows=6,005 width=12,484) (actual time=65,912.846..91,733.980 rows=5,463 loops=3)

  • Output: payrollitem8.userid, PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 2) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 2) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 6) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 6) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 8) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 8) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 9) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 9) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 5) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 5) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 14) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 14) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 15) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 15) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 16) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 16) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 19) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 19) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 20) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 20) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 21) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 21) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 18) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 18) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 12) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 12) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 22) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 22) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 17) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 17) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 23) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 23) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 24) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 24) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 25) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 25) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 26) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 26) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 27) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 27) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 28) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 28) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 29) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 29) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 30) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 30) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 31) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 31) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 32) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 32) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 33) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 33) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 34) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 34) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 35) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 35) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 36) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 36) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 37) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 37) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 38) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 38) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 59) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 59) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 92) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 92) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 93) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 93) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 7) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 7) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 10) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 10) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 125) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 125) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 11) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 11) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 1) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 1) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 126) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 126) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 127) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 127) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 128) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 128) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 129) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 129) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 130) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 130) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 131) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 131) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 132) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 132) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 134) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 134) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 135) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 135) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 3) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 3) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 4) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 4) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 158) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 158) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN (payrollitem8.paycodeid = 159) THEN payrollitem8.duration ELSE NULL::interval END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 1)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 2)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 3)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 4)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 5)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 6)) THEN payrollitem8.payamount ELSE NULL::numeric END), PARTIAL sum(CASE WHEN ((payrollitem8.paycodeid = 159) AND (payrollitem8.paycurrencyid = 7)) THEN payrollitem8.payamount ELSE NULL::numeric END)
  • Group Key: payrollitem8.userid
  • Buffers: shared hit=4,518,070 read=212,142
  • Worker 0: actual time=65,923.580..91964.385 rows=5,449 loops=1
  • Buffers: shared hit=1,506,666 read=71,050
  • Worker 1: actual time=65,903.428..91969.407 rows=5,461 loops=1
  • Buffers: shared hit=1,506,092 read=70,264
11. 897.208 66,332.698 ↓ 1.0 1,371,984 3 / 3

Sort (cost=673,906.26..677,289.60 rows=1,353,336 width=31) (actual time=65,911.474..66,332.698 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: 156,053kB
  • Buffers: shared hit=4,518,070 read=212,142
  • Worker 0: actual time=65,921.861..66350.466 rows=1,379,344 loops=1
  • Buffers: shared hit=1,506,666 read=71,050
  • Worker 1: actual time=65,902.774..66317.825 rows=1,368,288 loops=1
  • Buffers: shared hit=1,506,092 read=70,264
12. 1,340.904 65,435.490 ↓ 1.0 1,371,984 3 / 3

Hash Join (cost=148,177.41..536,081.93 rows=1,353,336 width=31) (actual time=43,323.617..65,435.490 rows=1,371,984 loops=3)

  • Output: payrollitem8.userid, payrollitem8.paycodeid, payrollitem8.duration, payrollitem8.paycurrencyid, payrollitem8.payamount
  • Inner Unique: true
  • Hash Cond: (payrollitem8.id = payrunpayrollitem9.payrollitemid)
  • Buffers: shared hit=4,518,056 read=212,142
  • Worker 0: actual time=43,317.053..65432.662 rows=1,379,344 loops=1
  • Buffers: shared hit=1,506,659 read=71,050
  • Worker 1: actual time=43,318.061..65428.357 rows=1,368,288 loops=1
  • Buffers: shared hit=1,506,085 read=70,264
13. 20,834.464 20,834.464 ↑ 1.0 2,057,688 3 / 3

Parallel Index Scan using ixpri_paycodeidpaycodeid on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem8 (cost=0.43..382,466.13 rows=2,071,930 width=47) (actual time=45.199..20,834.464 rows=2,057,688 loops=3)

  • Output: payrollitem8.id, payrollitem8.userid, payrollitem8.paycodeid, payrollitem8.entrydate, payrollitem8.duration, payrollitem8.payamount, payrollitem8.paycurrencyid, payrollitem8.originuri, payrollitem8.payableitemid
  • Index Cond: ((payrollitem8.paycodeid IS NOT NULL) AND (payrollitem8.paycodeid = ANY ('{2,6,8,9,5,14,15,16,19,20,21,18,12,22,17,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,59,92,93,7,10,125,11,1,126,127,128,129,130,131,132,134,135,3,4,158,159}'::integer[])))
  • Filter: ((payrollitem8.userid <> 1) AND (payrollitem8.entrydate <= '2019-04-28'::date))
  • Rows Removed by Filter: 39,404
  • Buffers: shared hit=1,004 read=187,340
  • Worker 0: actual time=40.377..20837.157 rows=2,064,791 loops=1
  • Buffers: shared hit=381 read=63,374
  • Worker 1: actual time=40.071..20830.679 rows=2,054,385 loops=1
  • Buffers: shared hit=354 read=62,041
14. 1,373.409 43,260.122 ↓ 1.0 4,115,953 3 / 3

Hash (cost=96,829.30..96,829.30 rows=4,107,814 width=16) (actual time=43,260.122..43,260.122 rows=4,115,953 loops=3)

  • Output: payrunpayrollitem9.payrollitemid
  • Buckets: 4,194,304 Batches: 1 Memory Usage: 225,704kB
  • Buffers: shared hit=4,517,029 read=24,802
  • Worker 0: actual time=43,257.062..43257.062 rows=4,115,953 loops=1
  • Buffers: shared hit=1,506,268 read=7,676
  • Worker 1: actual time=43,259.780..43259.781 rows=4,115,953 loops=1
  • Buffers: shared hit=1,505,721 read=8,223
15. 41,886.713 41,886.713 ↓ 1.0 4,115,953 3 / 3

Index Only Scan using uixprpri_payrunidpayrollitemid on a6421d95b0a34a9e8f9812e0af8929f0.payrunpayrollitem payrunpayrollitem9 (cost=0.56..96,829.30 rows=4,107,814 width=16) (actual time=26.687..41,886.713 rows=4,115,953 loops=3)

  • Output: payrunpayrollitem9.payrollitemid
  • Index Cond: (payrunpayrollitem9.payrunid = '920453a8-89f8-47c7-b814-8aaf165a3181'::uuid)
  • Heap Fetches: 0
  • Buffers: shared hit=4,517,029 read=24,802
  • Worker 0: actual time=23.638..41876.589 rows=4,115,953 loops=1
  • Buffers: shared hit=1,506,268 read=7,676
  • Worker 1: actual time=26.337..41887.957 rows=4,115,953 loops=1
  • Buffers: shared hit=1,505,721 read=8,223
16.          

SubPlan (for Subquery Scan)

17. 28.635 28.635 ↑ 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.012..0.015 rows=1 loops=1,909)

  • Output: userinfo1.firstname
  • Index Cond: (userinfo1.id = payrollitem0.userid1)
  • Buffers: shared hit=5,724 read=19
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. 736.874 736.874 ↑ 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.382..0.386 rows=1 loops=1,909)

  • Output: login3.loginname
  • Index Cond: (login3.userid = payrollitem0.userid1)
  • Buffers: shared hit=5,544 read=199
20. 97,239.395 97,239.395 ↑ 6,288,979.0 1 1

Seq Scan on a6421d95b0a34a9e8f9812e0af8929f0.payrollitem payrollitem11 (cost=0.00..362,410.79 rows=6,288,979 width=8) (actual time=97,239.395..97,239.395 rows=1 loops=1)

  • Output: $4
  • Buffers: shared hit=1,522,341 read=71,047
Planning time : 405.387 ms
Execution time : 97,291.682 ms