90: := CN_SRP_PERIODS_PVT.G_MISS_DELTA_SRP_PERIOD_REC;
91:
92: CURSOR salesrep_cr IS
93: SELECT salesrep_id, start_date, end_date, period_id, end_period_id
94: FROM cn_process_batches_all
95: WHERE physical_batch_id = p_srp_subledger.physical_batch_id
96: ORDER BY process_batch_id;
97:
98: l_salesrep salesrep_cr%ROWTYPE;
100: l_dummy number;
101:
102: cursor end_calc is
103: select 1
104: from cn_process_batches_all
105: where physical_batch_id = p_srp_subledger.physical_batch_id
106: and trx_batch_id = physical_batch_id
107: and rownum = 1;
108:
115: min(a.start_date) start_date,
116: max(a.end_date) end_date,
117: min(a.period_id) period_id,
118: max(a.end_period_id) end_period_id
119: from cn_process_batches_all a,
120: cn_srp_payee_assigns_all b
121: where a.logical_batch_id = (select logical_batch_id
122: from cn_process_batches_all
123: where physical_batch_id = p_srp_subledger.physical_batch_id
118: max(a.end_period_id) end_period_id
119: from cn_process_batches_all a,
120: cn_srp_payee_assigns_all b
121: where a.logical_batch_id = (select logical_batch_id
122: from cn_process_batches_all
123: where physical_batch_id = p_srp_subledger.physical_batch_id
124: and rownum = 1)
125: and a.salesrep_id = b.salesrep_id
126: and a.org_id = b.org_id
152: cursor sync_recs_cr is
153: select sp.salesrep_id, sp.credit_type_id, min(sp.period_id) period_id
154: from cn_srp_periods_all sp,
155: cn_srp_payee_assigns_all spa,
156: cn_process_batches_all pb
157: where pb.logical_batch_id = (select logical_batch_id
158: from cn_process_batches_all
159: where physical_batch_id = p_srp_subledger.physical_batch_id
160: and rownum = 1)
154: from cn_srp_periods_all sp,
155: cn_srp_payee_assigns_all spa,
156: cn_process_batches_all pb
157: where pb.logical_batch_id = (select logical_batch_id
158: from cn_process_batches_all
159: where physical_batch_id = p_srp_subledger.physical_batch_id
160: and rownum = 1)
161: and pb.salesrep_id = spa.salesrep_id
162: and spa.org_id = g_org_id
297: cn_message_pkg.debug('Start updating payment subledgers ... ');
298:
299: -- Code starts here
300: select org_id into g_org_id
301: from cn_process_batches_all
302: where physical_batch_id = p_srp_subledger.physical_batch_id
303: and rownum = 1;
304:
305: l_calc_type := cn_calc_sub_batches_pkg.get_calc_type