162:
163: if w2_tax_unit_id is not null then
164: if w2_jurisdiction_code <> '00-000-0000' then
165: --dbms_output.put_line('got jd and gre as not null ');
166: select nvl(fnd_number.canonical_to_number(fai.value),0) into l_bal_amt
167: from ff_archive_items fai,
168: ff_archive_item_contexts fic1,
169: ff_archive_item_contexts fic2
170: where fai.context1 = w2_asg_act_id
176: and fic2.context_id = l_jd_context_id
177: and substr(ltrim(rtrim(fic2.context)),1,w2_jurisdiction_level) = substr(w2_jurisdiction_code,1,w2_jurisdiction_level);
178: else
179: --dbms_output.put_line('got jd as null and gre as not null ');
180: select nvl(fnd_number.canonical_to_number(fai.value),0) into l_bal_amt
181: from ff_archive_items fai,
182: ff_archive_item_contexts fic
183: where fai.context1 = w2_asg_act_id
184: and fai.user_entity_id = l_user_entity_id
188: end if;
189: else
190: if w2_jurisdiction_code <> '00-000-0000' then
191: --dbms_output.put_line('got jd as not null and gre as null ');
192: select nvl(fnd_number.canonical_to_number(fai.value),0) into l_bal_amt
193: from ff_archive_items fai,
194: ff_archive_item_contexts fic
195: where fai.context1 = w2_asg_act_id
196: and fai.user_entity_id = l_user_entity_id
198: and fic.context_id = l_jd_context_id
199: and substr(ltrim(rtrim(fic.context)),1,w2_jurisdiction_level) = substr(w2_jurisdiction_code,1,w2_jurisdiction_level);
200: else
201: --dbms_output.put_line('got jd and gre as null ');
202: select nvl(fnd_number.canonical_to_number(fai.value),0) into l_bal_amt
203: from ff_archive_items fai
204: where fai.context1 = w2_asg_act_id
205: and fai.user_entity_id = l_user_entity_id;
206: end if;