EBS-Print customized aging table Elegant idea

Make full use of the aging table configuration information that comes with EBS, so that when the aging configuration changes later, do not change the business code, only need to change the front-end aging table configuration.

The overall idea is to first subtract the date on the business document (general ledger date or business date) from the current date to get a value. For past_days, the negative value should be considered here. For example, the period is 6.30, but the date of the business document is 7.4 , past_days is -4. This negative number should be regarded as 0.

Then, based on the configuration of the aging table, the cycle is performed, such as the example code of the aging table of the payable module:

--AP 账龄表sql提取配置示例
SELECT /*lines.days_start*/
                  decode(lines.days_start, 0, -999999, lines.days_start) days_start, --将0改为-999999 来避免因发票日期晚于gl日期导致负数出现
                  lines.days_to,
                  lines.period_sequence_num,
                  report_heading1,
                  report_heading2
                   FROM ap_aging_period_lines lines,
                        ap_aging_periods      periods
                  WHERE lines.aging_period_id = periods.aging_period_id
                    AND periods.aging_period_id = 10000
                    AND periods.status = 'A'
                  ORDER BY lines.period_sequence_num

The display effect is as follows

--应付模块账龄表流程
begin
  for ap_age in (SELECT /*lines.days_start*/
                  decode(lines.days_start, 0, -999999, lines.days_start) days_start, --将0改为-999999 来避免因发票日期晚于gl日期导致负数出现
                  lines.days_to,
                  lines.period_sequence_num,
                  report_heading1,
                  report_heading2
                   FROM ap_aging_period_lines lines,
                        ap_aging_periods      periods
                  WHERE lines.aging_period_id = periods.aging_period_id
                    AND periods.aging_period_id = 10000
                    AND periods.status = 'A'
                  ORDER BY lines.period_sequence_num)
  
   loop
    SELECT SUM(t.balance)
      INTO v_aging_balance
      FROM cux_ap_pre_aging_temp t --业务单据汇总临时表
     WHERE t.past_days BETWEEN ap_age.days_start AND ap_age.days_to;
  
    print_f('<td class=xl8218914>' || to_char(v_aging_balance) || '</td>');
  
  end loop;

end;

The receivable module is similar. The receivable module takes the aging table configuration sql as follows:

select h.bucket_name,
       h.description,
       l.DAYS_START,
       l.DAYS_TO,
       l.REPORT_HEADING1
  from ar_aging_buckets h, ar_aging_bucket_lines l
 where h.aging_bucket_id = l.AGING_BUCKET_ID
   and h.bucket_name = '十四时段帐龄'
 order by l.BUCKET_SEQUENCE_NUM

Guess you like

Origin blog.csdn.net/x6_9x/article/details/127734448