[Home] [Help]
42: p_out_rem_amt_inv OUT NOCOPY NUMBER,
43: P_called_from IN VARCHAR2) IS
44:
45: p_ps_rec ar_payment_schedules%ROWTYPE;
46: p_disc_rec arp_calculate_discount.discount_record_type;
47:
48: l_grace_days NUMBER;
49: l_customer_id NUMBER;
50: l_site_use_id NUMBER;
73: END IF;
74:
75: -- Get payment schedule info and populate the payment schedule record
76: p_ps_rec.payment_schedule_id := p_ps_id;
77: arp_calculate_discount.get_payment_schedule_info(p_disc_rec, p_ps_rec);
78:
79: IF PG_DEBUG in ('Y', 'C') THEN
80: arp_standard.debug('get_discount: ' || 'initialized payment schedule record');
81: END IF;
166: l_amt_in_dispute := NULL;
167: END IF;
168:
169: -- Call the discounts package.
170: arp_calculate_discount.calculate_discounts(
171: p_in_applied_amount, --input
172: l_grace_days,
173: p_apply_date, --input
174: p_disc_rec.disc_partial_pmt_flag,
282: p_out_discount OUT NOCOPY NUMBER,
283: p_out_applied_amt OUT NOCOPY NUMBER) IS
284:
285: p_ps_rec ar_payment_schedules%ROWTYPE;
286: p_disc_rec arp_calculate_discount.discount_record_type;
287:
288: p_mode NUMBER;
289: l_customer_id NUMBER;
290: l_site_use_id NUMBER;
368: END IF;
369:
370: -- Populate the payment schedule record.
371: p_ps_rec.payment_schedule_id := p_ps_id;
372: arp_calculate_discount.get_payment_schedule_info(p_disc_rec, p_ps_rec);
373: IF PG_DEBUG in ('Y', 'C') THEN
374: arp_standard.debug('get_max_discount: ' || 'Initialized the payment schedule record');
375: END IF;
376:
381: p_out_discount := 0;
382: else
383:
384: --Get Discount Percentages
385: arp_calculate_discount.get_discount_percentages (p_disc_rec, p_ps_rec);
386: IF PG_DEBUG in ('Y', 'C') THEN
387: arp_standard.debug('get_max_discount: ' || 'Calculated Discount percentages');
388: END IF;
389:
389:
390: -- Correct percentages for lines-only(ardline) discount if necessary.
391: IF p_disc_rec.calc_disc_on_lines <> 'I' AND
392: p_disc_rec.calc_disc_on_lines <> 'N' THEN
393: arp_calculate_discount.correct_lines_only_discounts ( p_disc_rec, p_ps_rec );
394: END IF;
395: --
396:
397: -- If no discount percentages, set discounts to zero.
403: --Calculate max discount available
404: IF PG_DEBUG in ('Y', 'C') THEN
405: arp_standard.debug('get_max_discount: ' || 'Calling MAX discount routine() +');
406: END IF;
407: arp_calculate_discount.determine_max_allowed_disc
408: ( p_mode, p_disc_rec, p_ps_rec );
409:
410:
411: p_out_discount := nvl(p_disc_rec.max_disc,0);